ho can i convert a structure to a matrix?

580 次查看(过去 30 天)
ho can i convert a structure to a matrix?

采纳的回答

Walter Roberson
Walter Roberson 2015-7-23
cell2mat(struct2cell(YourStructure))
  3 个评论
Jacqueline Kelly
Jacqueline Kelly 2020-9-25
What if the cells aren't of the same data type? I have some strings and some numbers
Walter Roberson
Walter Roberson 2020-9-25
struct and cell are different datatypes; you need to be clear as to which you are working with for this purpose.
If you have a mix of strings and numbers, then what is your hope as to the datatype of the final matrix ? You can only combine strings and numbers in a single object if it is one of the composite datatypes such as struct, cell, or table.

请先登录,再进行评论。

更多回答(1 个)

muhammed boztoprak
muhammed boztoprak 2019-5-30
Really great answer!!! Thank you very much.

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by