필터 지우기
필터 지우기

dynamic naming using eval(.)

조회 수: 1 (최근 30일)
xplore29
xplore29 2013년 3월 26일
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

채택된 답변

James Tursa
James Tursa 2013년 3월 26일
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.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 26일

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by