0

On Matlab coder I get the error "FOR loop index expressions of unknown size are only supported if they are of the form A:B or A:B:C" whenever I use for indexing a vector in a for loop, example:

for e=s:-1:1
for l=1:s
    for k=1:b       
    E=find(sum(B(:,l,:))==k)';
    coder.varsize('E', [1,70],[0,1]);
        for j=E
            coder.varsize('i', [1,70],[0,1]);
            for i=E
                if isequal(B(:,e,i),B(:,e,j)) %for k=1 we want the second column of i to be identical to the first colum of j or vice versa. 
                    if isequal(sort(sum(B(1:s,s+1:b+s,i))),sort(sum(B(1:s,s+1:b+s,j))))
                        B(:,l,i)=B(:,l,j);
                        B(l,:,i)=B(l,:,j);
                    else
                        ;
                    end
                end
            end
        end
    end
end
end

I understand that coder need something like "A:B" but my vector E here contains for example [7,11,13] and I cannot use something like "E(1,1):E(1,3)" because then I obvisouly get 7 8 9 10 11 12 13.

Any suggestions on how I could modify the code?

thank you

1 Answer 1

1

Why not simply do:

for ind = 1:length(E)
    i = E(ind);
    % ...
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.