how to solv this issue?
Mostra commenti meno recenti
LastName = {'Sanchez';'Johnson';'Li';'Diaz'};
Age = [38;43;38;40];
Smoker = logical([1;0;1;0]);
Height = [71;69;64;67];
Weight = [176;163;131;119];
BloodPressure = [93; 77; 83;80];
BP=[125;135;146;150]
T = table(LastName,Age,Smoker,Height,Weight,BloodPressure,BP)
T1=table2cell(T)
T2=T1(:,2:5)
for i=1:4
for j=1:4
properties=T2(i,j);
end
temp1=T2(i,1);
temp2=T2(i,2);
temp3=T2(i,3);
temp4=T2(i,4);
temp5=T2(i,5);
create(temp1,temp2,temp3,temp4,temp5)
end
function create(temp1,temp2,temp3,temp4,temp5) % now i explained in detail my code
disp('age is')
disp(temp1)
if height==0
disp(temp4)
elseif height==1
disp(temp5)
end
end
% % error index in posiotion exceeds array bounds index must not exceeds 4
% R = [25;50;100;250] This is part of my program which i have tried
% to explain in simple way
% L=10
% A=5
% for i=1:4
% res=R(i)
% resistivity(R,A,L)
% end
%
% function resistivity(R,A,L)
% Rho=(R*L)/A
% end
i am getting an error index exceeds array bounds
how to rectify this error?
2 Commenti
David Hill
il 12 Apr 2022
Where is your error. Code executes without error for me.
ramya
il 12 Apr 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!