Change char to cell

6 ビュー (過去 30 日間)
flashpode
flashpode 2021 年 10 月 22 日
回答済み: Image Analyst 2021 年 10 月 25 日
Hi, I've got a variable that is a cell array with some chars inside and I want to split those chars to get all cells. I had this problem with strings inside the cell array and they helped me with a function named cellstr but now I do not find a function that does this to me. Thanks in advance.
That is what I have:
Time_msg_match(61649)
ans =
1×1 cell array
{2×5 char}
  2 件のコメント
Jan
Jan 2021 年 10 月 22 日
Please post some code, which produces test data and the wanted output.
flashpode
flashpode 2021 年 10 月 22 日
The code That I have does another thing.
but I have:
Time_msg_match{K} = complete_match_AIS
Gives me the position of every message from complete_match_AIS(The matching messages from AIS1 and AIS2). Then I want to get the time from Time_AIS1(Duration variable of the messages from AIS1) and write it in the variable Time_msg_match. Did I explain myself?

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

採用された回答

Image Analyst
Image Analyst 2021 年 10 月 25 日

その他の回答 (1 件)

Chunru
Chunru 2021 年 10 月 22 日
msg{1} =['abc12';'def34']
msg = 1×1 cell array
{2×5 char}
msgc = cellstr(msg{1})
msgc = 2×1 cell array
{'abc12'} {'def34'}
  3 件のコメント
Stephen23
Stephen23 2021 年 10 月 22 日
"I post and Image to see the differences from element 5 and the other ones"
Yep, it is quite clear that element five is a scalar numeric array, not a character array. So your original description in your question "I've got a variable that is a cell array with some chars inside" is not completely correct: it also has numeric arrays inside too.
flashpode
flashpode 2021 年 10 月 22 日
I did not know it till now. But I do not know why do I get different type data if my code is just:
Time_msg_match{K} = complete_match_AIS;
That gives me the position of the messages but what I really want is a variable that has the time of the messages

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

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by