MATLAB Code Call Cell Array Variable
Show older comments
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 Comments
Walter Roberson
on 5 Jun 2018
Which line is the error occurring on?
Stephen23
on 6 Jun 2018
@Sarah Crimi: please show the complete error message. This means all of the red text.
Answers (1)
Sarah Crimi
on 6 Jun 2018
0 votes
Categories
Find more on Logical 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!