Adressing a cell
古いコメントを表示
I ran into an issue today and got it sorted out, but I want to understand what the reasoning behind it is.
I have a 1x10 cell named Rx{n},n=1:10. For simplicity's sake, lets just say the cells are filled sequentially 1-10.
Rx(5)=5
Also:
Rx{1,5}=5
I ran into an issue when I was trying to use the values in a legend.
legend(Rx(1),Rx(2)...) -Does not work
legend(Rx{1,1},Rx{1,2}...) -Does work
Since it is not a cell array, and each cell just contains 1 value, why aren't these equivalent?
採用された回答
その他の回答 (1 件)
the cyclist
2011 年 10 月 20 日
0 投票
In the case that works, you are using curly brackets, which means you are referring to the contents of the cell, which is presumably an appropriate input to the legend() function.
In the case that does not work, you are using parenthesis, which means you are referring to the cell itself (not the contents of the cell), and that is not a valid input to the legend() function.
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!