MATLAB Code Call Cell Array Variable

1 Ansicht (letzte 30 Tage)
Sarah Crimi
Sarah Crimi am 5 Jun. 2018
Beantwortet: Sarah Crimi am 6 Jun. 2018
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 Kommentare
Walter Roberson
Walter Roberson am 5 Jun. 2018
Which line is the error occurring on?
Stephen23
Stephen23 am 6 Jun. 2018
@Sarah Crimi: please show the complete error message. This means all of the red text.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sarah Crimi
Sarah Crimi am 6 Jun. 2018
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

Kategorien

Mehr zu Matrices and Arrays 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