Singleton error causing mismatch?

5 ビュー (過去 30 日間)
David Pesetsky
David Pesetsky 2018 年 6 月 24 日
コメント済み: David Pesetsky 2018 年 6 月 26 日
What is going on here?
Assignment has more non-singleton rhs dimensions than non-singleton
subscripts
Error in Reduced_DLF_finder (line 18)
report(i,1)=props(i).name;
The props piece comes out with a single string, like 'hello', when I type it in the Matlab window. Just trying to put it into a slot in a report table I'm building.
What am I doing wrong?

回答 (1 件)

per isakson
per isakson 2018 年 6 月 24 日
編集済み: per isakson 2018 年 6 月 24 日
Try replacing
report(i,1)=props(i).name;
by
report(i,1)={props(i).name};
and see table, Table array with named variables that can contain different types together with its references See also:.
  7 件のコメント
per isakson
per isakson 2018 年 6 月 25 日
編集済み: per isakson 2018 年 6 月 25 日
"But now, "report" is a cell array" I though report was a Matlab table, which should be obvious from my answer and comments. I might have been mistaken. However, you didn't put me straight. Now you say that report is a cell array.
"csvwrite chokes on the mixture of cell types" That is an expected behaviour. (It's easier to write a table to a file.) See the text under the Examples tab of tprintf, tprintf writes tabular data to a text file on printing cell arrays to text files.
David Pesetsky
David Pesetsky 2018 年 6 月 26 日
Is these any simpler way to export the cell array to txt or xls?

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by