MatLab won't allow me to label the columns in a table that I created
16 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to create a very simple table via the following code:
Latency_Info = [124, 203, 301; 143, 201, 280]
Latency_Table = table(Latency_Info)
Latency_Table.Row = ["T7", "T8"]
Latency_Table.Variables = ["P1", "N1", "P2"]
I am able to add the row names via this code, however, when I try to lable the coloumns of the table, I get the following error:
"To assign to, or create a variable in a table, the number of rows must match the height of the table."
Could anyone point me in the right direction to address this issue
0 件のコメント
採用された回答
Star Strider
2019 年 11 月 10 日
You are not creating your table correctly, and you are not using the correct syntax to set the row and column names.
Try this:
Latency_Info = [124, 203, 301; 143, 201, 280];
Latency_Table = array2table(Latency_Info);
Latency_Table.Properties.RowNames = ["T7", "T8"];
Latency_Table.Properties.VariableNames = ["P1", "N1", "P2"];
producing:
Latency_Table =
2×3 table
P1 N1 P2
___ ___ ___
T7 124 203 301
T8 143 201 280
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!