フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do put the values within a cell in a matrix?

2 ビュー (過去 30 日間)
Samuele Bolotta
Samuele Bolotta 2020 年 4 月 2 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
dff1 = [];
dff2 = [];
dff3 = [];
dff4 = [];
num_dff = rand(5121,2);
wholedff = {dff1, dff2, dff3, dff4};
for i = 1:length(wholedff)
wholedff{i} = num_dff
end
This code gives me the values I'd like to see but in the 1x4 cell wholedff, not in the single dffs (dff1, dff2, dff3, dff4), which remain empty. How do I create this link? Thanks!

回答 (1 件)

David Hill
David Hill 2020 年 4 月 2 日
dff1=wholedff{1};
dff2=wholedff{2};
...
but why would you want to do that? That is why we do indexing so we do not have to have so many variables.
  3 件のコメント
David Hill
David Hill 2020 年 4 月 2 日
Instead of assigning variables to them, do the operations using wholedff{1} or wholedff{2}. For example:
wholedff{1}=[wholedff{1},5]*10;
No need for a bunch of variables.
Samuele Bolotta
Samuele Bolotta 2020 年 4 月 2 日
Yeah this actually makes a lot of sense. Great, thanks man!

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by