MATLAB Code Call Cell Array Variable

1 次查看(过去 30 天)
I am using one function to call another. I have a cell that contains several pieces of data in 220 different columns of the cell. I am getting an error when I call the function below from the main function. It says "Function 'subsindex' is not defined for values of class 'cell'." Can I not pass the cell array data through the function?
function [] =plotdetailsdata(data1)
num = length(data1);
v_ceil = ceil(num/50);
v_floor = floor(num/50)
for j=0:v_floor
%
num1 = (j*50)+1;
num2 = num1+50 ;
if((num2)>length(data1))
num2 = length(data1)
end
%
figure(j+1+2);
hold on;
%
for i=num1:num2
m = data1{1,i};
plot(m(:,1),m(:,2));
legendCell{i} = num2str(i,'N=%-d');
end
%
title(['Real Impedance from ', num2str(num1), ' to ', num2str(num2)])
hold off;
legend(legendCell{num1:num2});
fig = figure;
datacursormode on;
%
filename=strcat('Figure',num2str(num1),'to',num2str(num2),'RealImp.fig');
savefig(fig,filename)
dcm_obj = datacursormode(fig);
set(dcm_obj,'UpdateFcn',@myfunction)
%
end
legend('show')
end
%
  2 个评论
Stephen23
Stephen23 2018-6-6
@Sarah Crimi: please show the complete error message. This means all of the red text.

请先登录,再进行评论。

回答(1 个)

Sarah Crimi
Sarah Crimi 2018-6-6
Ah, I think I figured it out. I accidentally named a variable the same thing as my function name. So silly. Thanks for your help. ~Sarah

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by