help please (error: number of elements must be the same)

1 view (last 30 days)
There seems to be a problem but I couldn't fix it, if someone could help me I would be much grateful.
The code below gives the following error: ??? In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> aee206demircan at 5
member(i)=[ joints(i,1);joints(i,2) ];
The code :
joints=xlsread('joints.xlsx');
n=size(joints,1);
for i=1,n;
member(i)=[ joints(i,1);joints(i,2) ];
end
plot3(member(:,1),member(:,2),member(:,3))

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 14 Apr 2014
Edited: Azzi Abdelmalek on 14 Apr 2014
What do you want to create with this?
member(i)=[ joints(i,1);joints(i,2) ];
Maybe you want
member(1:2,i)=[joints(i,1);joints(i,2) ];
But in this case you can't write
plot3(member(:,1),member(:,2),member(:,3))
Because member is 2xn array

Image Analyst
Image Analyst on 14 Apr 2014
If you want to plot them as x,y,z coordinates, why not try
joints=xlsread('joints.xlsx')
plot3(joints(:,1), joints(:,2), joints(:,3));

Categories

Find more on Multidimensional Arrays 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!