Filter löschen
Filter löschen

dynamic naming using eval(.)

1 Ansicht (letzte 30 Tage)
xplore29
xplore29 am 26 Mär. 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

Akzeptierte Antwort

James Tursa
James Tursa am 26 Mär. 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.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 26 Mär. 2013

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by