MATLAB Code Call Cell Array Variable

조회 수: 1 (최근 30일)
Sarah Crimi
Sarah Crimi 2018년 6월 5일
답변: Sarah Crimi 2018년 6월 6일
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
Walter Roberson
Walter Roberson 2018년 6월 5일
Which line is the error occurring on?
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