dynamic naming using eval(.)

1 view (last 30 days)
xplore29
xplore29 on 26 Mar 2013
I am creating new matrices in a loop
IP = IP_count(:);
x=IP_count_length;
for i=1:IP_count_length
eval(['FBSeq' num2str(i) '_Table' '=BinaryCombination(IP(i))'])
end
//FBSeq1_Table;
//FBSeq2_Table;
.
.
.
//FBSeqx_Table
% Binary combination function just computes all possible binary combinations of length (IP(i))
These matrices are of different dimensions. Now I want to pass these newly created matrices to a function.
How can I do this task. Moreover how can I perform processing of particular row/col of any of these matrices later on. Since I have used dynamic naming of these matrices , I dont know how can I call them

Accepted Answer

James Tursa
James Tursa on 26 Mar 2013
I would advise using a cell array instead. E.g.,
IP = IP_count(:);
x = IP_count_length;
FB = cell(1,IP_count_length);
for i=1:IP_count_length
FB{i} = BinaryCombination(IP(i));
end
Then you can just pass FB to your function.

More Answers (1)

Walter Roberson
Walter Roberson on 26 Mar 2013

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!