converting an array of n symbolic variables to a cell array with n elements
1 回表示 (過去 30 日間)
古いコメントを表示
Hi
Could somebody tell me a way to convert the symbolic array [ x, y , z ] to the 3 element cell array Cell, where Cell{1} = x, Cell{2} = y, etc? You would think it should be possible to do this with mat2cell, but this converts [ x, y, z ] to the a single element cell variable, i.e., Y = cell2mat([x,y,z]) returns T{1} = [ x,y,z].
Thanks!
0 件のコメント
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 1 月 12 日
編集済み: Azzi Abdelmalek
2013 年 1 月 12 日
syms x y z
a=[x y z]
for k=1:numel(a)
A{k}=a(k)
end
2 件のコメント
José-Luis
2013 年 1 月 12 日
Loops are not always evil. They can make for clearer code and are sometimes faster than the vectorized alternative.
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!