accessing variable names of cell arrays in another function
이전 댓글 표시
Hi,
I have a function that has say 3 variables of different size (and this could vary for different input files):
EvVel = 301 x 12
EvAcc = 300 x 12
EvJerk = 299 x 12
I have assigned each of them to a cell array as I have to pass them to a function that generates reports:
my_array{1} = EvVel;
my_array{2} = EvAcc;
my_array{3} = EvJerk;
temp = repgen(my_array)
function repgen(my_array)
plot(my_array{1});
title('EvVel') %I am having problem accessing the variable name here as I am passing cell array
end
댓글 수: 1
Stephen23
2020년 8월 27일
"I am having problem accessing the variable name here as I am passing cell array"
Once you put the data into a cell array then any possible names of variables used for those arrays are no longer known. The best approach would be to store that meta-data as data in its own right and not put meta-data into variable names, then your code would be more generalized.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!