convert arraycell in array string

>> class(risulRankingResult)
ans =
'cell'
it's possibile to convert in string?

1 件のコメント

James Tursa
James Tursa 2023 年 7 月 11 日
What would be your desired output?

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

 採用された回答

Stephen23
Stephen23 2023 年 7 月 11 日

0 投票

"it's possibile to convert in string?"
Probably. I am guessing that you want something like this:
C = {1;[2,34];[56,7,89]}
C = 3×1 cell array
{[ 1]} {[ 2 34]} {[56 7 89]}
F = @(v)join(string(v),',');
S = cellfun(F,C)
S = 3×1 string array
"1" "2,34" "56,7,89"

6 件のコメント

aldo
aldo 2023 年 7 月 11 日
thanks you
aldo
aldo 2023 年 7 月 12 日
編集済み: aldo 2023 年 7 月 12 日
it's possible to reverse operation (convert S in array of number..i.e. a matrix)
Stephen23
Stephen23 2023 年 7 月 12 日
"it's possible to reverse operation (convert S in array of number)?"
It is inefficient to keep changing types like that, but it is possible. Here is one approach:
S = ["1";"2,34";"56,7,89"]
S = 3×1 string array
"1" "2,34" "56,7,89"
F = @(t)sscanf(t,'%f,',[1,Inf]);
C = arrayfun(F,S,'uni',0)
C = 3×1 cell array
{[ 1]} {[ 2 34]} {[56 7 89]}
aldo
aldo 2023 年 7 月 12 日
thanks but i've a problem...
i want to use Sis.Rank_DisplayIdxSis (in a structure)
now i must to convert it in arraycell...can you help?
Stephen23
Stephen23 2023 年 7 月 12 日
"i want to use Sis.Rank_DisplayIdxSis (in a structure) now i must to convert it in arraycell..."
I presume by "arraycell" you actually mean a cell array.
It is unclear to me what you want to convert and what the problem is.
aldo
aldo 2023 年 7 月 12 日
編集済み: aldo 2023 年 7 月 12 日
I presume by "arraycell" you actually mean a cell array. ==> yes
n Rank_DisplayIdxsis i use it for 2 solution:
1) display in a table in app designer and with your first statement i saved with comma in strings
2) now i want to use them as array of numbers (matrix) so I have to get from Rank_DisplayIdxsis an array of numbers

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2023 年 7 月 11 日

編集済み:

2023 年 7 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by