Error when creating table
3 views (last 30 days)
Show older comments
I am trying to create this table and i keep getting this error. Why? and how do I fix it?
clc;clear;
startAngle = [1,2];
middleAngle = [1,2];
endAngle = [1,2];
tableHeader = ["Start","Transition","End"];
putterNames = ["Putter1 :","Putter 2:"];
a = table(startAngle,middleAngle,endAngle,'RowNames', putterNames, 'VariableNames', tableHeader);
display(a);
0 Comments
Accepted Answer
Voss
on 17 Jun 2022
If you try creating the table without the RowNames you'll see that your table actually has one row, and each element of the table is a 1-by-2 vector:
clc;clear;
startAngle = [1,2];
middleAngle = [1,2];
endAngle = [1,2];
tableHeader = ["Start","Transition","End"];
putterNames = ["Putter1 :","Putter 2:"];
a = table(startAngle,middleAngle,endAngle, 'VariableNames', tableHeader)
If you make those variables into column vectors when making the table, then specifying RowNames works:
a = table(startAngle(:),middleAngle(:),endAngle(:),'RowNames', putterNames, 'VariableNames', tableHeader)
0 Comments
More Answers (0)
See Also
Categories
Find more on Other Formats in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!