Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

computing matrices in a loop

1 Ansicht (letzte 30 Tage)
ss
ss am 27 Dez. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
hi could we have a loop in that for any i we produce a matrix f(i), I want to store f(i) for any i, I DO'T want to have this for i=1:4 f=.... end I want to have for i=1:4 f(i)=... end that f is a 6*6 matrix. but for this there is some error of dimension. could anyone guide me what I should do? thank you
  1 Kommentar
Azzi Abdelmalek
Azzi Abdelmalek am 27 Dez. 2012
Bearbeitet: Azzi Abdelmalek am 27 Dez. 2012
Post your code, we will try to find what is wrong with it

Antworten (1)

Kye Taylor
Kye Taylor am 27 Dez. 2012
Bearbeitet: Kye Taylor am 27 Dez. 2012
Try using cells, as in the example:
for i = 1:4
% creates i-by-i random matrix as ith cell contents. Note curly braces
f{i} = rand(i);
end
To access the contents of the ith cell, use f{i}, while f(i) accesses the cell itself.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by