Error using table (line 253) All variables must have the same number of rows.
Show older comments
i don't know why there's an error with my table. all varibales have 25 values.
here's my code
step= (0.0:0.2:5)';
Psi0= psiO(:,1)';
Psi1= psiO(:,6)';
Psi2= psiO(:,11)';
Psi3= psiO(:,16)';
Psi4= psiO(:,21)';
Psi5= psiO(:,26)';
table(step,Psi0,Psi1,Psi2,Psi3,Psi4,Psi5)
3 Comments
per isakson
on 15 Mar 2019
You might want to try to fix your code with the help of: Debug a MATLAB Program and Examine Values While Debugging
Ali Mulhi
on 15 Mar 2019
per isakson
on 17 Mar 2019
Edited: per isakson
on 17 Mar 2019
step= (0.0:0.2:5)';
>> length( step )
ans =
26
Accepted Answer
More Answers (1)
Peter Perkins
on 15 Mar 2019
Psi0 = array2table(psi0(:,[1 6 11 16 21 16])
would have been helpful for this. And then addvars to add step at the beginning.
2 Comments
or
[table(step), array2table(psi0(:,[1 6 11 16 21 16]))]
Either of these is a lot simpler than temporary numbered (!) variables.
Is there any difference between addvars and table concatenation?
Peter Perkins
on 18 Mar 2019
addvars lets you add new variables in the middle. It's really the only reason why it even exists.
Categories
Find more on Axis Labels 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!