How can i put in matrix data into cell array?

This is the matrix data extracted from my csv.
I want to put these data in each row of cell array. How should I write the code?
This is example, I want to make a cell like this.

1 件のコメント

Stephen23
Stephen23 2022 年 1 月 13 日
@지원 정: you did not tell us the most important information: how did you get all of these variables into the workspace?
Rather than writing bad code to try and fix that very bad data design (lots of separate numbered variables), by far the best solution is to avoid getting into this situation in the first place. We can help you do that, if you tell us how those variables got into the workspace in the first place: I doubt that you wrote them all by hand.

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

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2022 年 1 月 12 日

2 投票

Cell array
for i=1:length(matrix_data)
cell_data{i}=matrix_data;
end

4 件のコメント

지원 정
지원 정 2022 年 1 月 12 日
Thank you for your answer!!
My curiosity is that the number of matrix data is i. By the way, why is {i} behind the cell declaration?
I want to know why it's not NF{i}.
And it is said to be an unrecognized variable.
Stephen23
Stephen23 2022 年 1 月 12 日
編集済み: Stephen23 2022 年 1 月 12 日
"By the way, why is {i} behind the cell declaration?"
Very basic, simple, efficient indexing into a cell array:
"I want to know why it's not NF{i}."
Because trying to access variable names is slow, complex, inefficient, obfuscated code which is difficult to debug. Thus KALYAN ACHARJYA sensibly avoided that by writing much better code using indexing.
KALYAN ACHARJYA
KALYAN ACHARJYA 2022 年 1 月 12 日
編集済み: KALYAN ACHARJYA 2022 年 1 月 12 日
@Stephen Thanks for detail explanation.
지원 정
지원 정 2022 年 1 月 12 日
Thank you so much

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

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by