Conversion to string from struct is not possible.

How to convert to double in order to address each data in this case?

3 件のコメント

dpb
dpb 2022 年 5 月 11 日
"X" is a structure; it contains two fields.
X.data(i) will reference a member of the data array which is a double
X.textdata(i,j) will reference a given cell of the non-numeric data in the cell array.
What is in the cell array is unknown to us; whether it's something that one or more elements of could be converted to a double would take knowing what the content is; it wasn't recognized by the import tool apparently as such, though...
Wei Kang Cheng
Wei Kang Cheng 2022 年 5 月 11 日
how to solve this?
Benjamin Thompson
Benjamin Thompson 2022 年 5 月 11 日
X.data is already a matrix of doubles. Maybe you can post a smaller problem and show the output or result you are looking for? Post code or a sample MAT file with the data.

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

回答 (1 件)

Mitch Lautigar
Mitch Lautigar 2022 年 5 月 11 日

0 投票

Couple ways to handle this. I'll explain the top 2.
1 - Pull the data out of the struct.
num_data = x.data;
str_data = x.textdata;
You can now change the type if you wish.
2 - Convert to a cell array/table
This will put everything into a single array/table. Though you might have to format it a little bit.
Hope it helps! If it doesn't, reply and i'll answer when I can.

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

製品

リリース

R2022a

質問済み:

2022 年 5 月 11 日

回答済み:

2022 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by