Assigment error in a sym-to-char conversion
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I need to convert a 4x4xN symbolic matrix (called T) in a char, so, after initialization by
Tchar = char(zeros(4,4,N));
so I use a for loop with three indices (ii,jj,kk) as:
for ii=1:N
for jj=1:4
for kk=1:4
Tchar(jj,kk,ii) = char(T(jj,kk,ii));
end
end
end
but it returns me the error..:
Assignment has more non-singleton rhs dimensions than non-singleton
subscripts
but T-dimensions is equal to Tchar dimensions. What is the matter?
0 件のコメント
採用された回答
Walter Roberson
2012 年 11 月 26 日
If T is a symbolic matrix, changes are that the character representation of each entry is not exactly one character per entry, but you attempt to assign the character version of the entry to a single character location Tchar(jj,kk,ii).
I suggest
Tchar = cell(4,4,N);
and
Tchar{jj,kk,ii} = char(T(jj,kk,ii)); %notice {}
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Special Values についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!