Reputation: 43
I have an array (300x6) and I want to use it for this block in simulink. But I have a problem. How can I use "for iterator" block to take the q(i,:), q(i+1,:) , q(i+2,:) ... elements respectively? Or is there any other way to do this idea? Thanks.
Upvotes: 0
Views: 2054
Reputation: 112659
In Matlab, for
iterates over matrix columns. So you can just transpose to iterate over rows:
A = [1 2 3; 4 5 6; 7 8 9]; %// example matrix
for v = A.'
v = v.'; %// v will be [1 2 3], then [4 5 6] etc
%// Do stuff with v
end
I'm not into Simulink but I guess you can adapt this to that environment.
Upvotes: 1