How to take data from multiple variables and store them in one variable?
27 ビュー (過去 30 日間)
古いコメントを表示
suppose, I have 3 variables containg some data but I want to store all the datas of the 3 separate variables in a single variable.
0 件のコメント
採用された回答
Star Strider
2022 年 7 月 5 日
I am not certain what you want, however one option would be a cell array —
v1 = rand(3)
v2 = 'This is Variable #2'
v3 = exp(v1)
V = {v1, v2, v3}
.
0 件のコメント
その他の回答 (1 件)
John D'Errico
2022 年 7 月 5 日
編集済み: John D'Errico
2022 年 7 月 5 日
Essentially, you just need to learn MATLAB. Read the various tutorials you can find. In there you would learn about the various variable classes available.
There are structs.
A.num = 1:5;
A.str = "The quick brown fox";
A.mat = rand(2);
A
There re cell arrays.
B = cell(1,3);
B{1} = 1:5;
B{2} = "The quick brown fox";
B{3} = rand(2);
B
There are simple arrays.
C = zeros(3,3);
C(1,:) = ones(1,3);
C(2,:) = 1:3;
C(3,:) = rand(1,3);
C
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!