Filter löschen
Filter löschen

Info

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

Matlab placing loop results in array

1 Ansicht (letzte 30 Tage)
Mohammad Mahmoud
Mohammad Mahmoud am 15 Okt. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I have a matlab code which is pretty complicated and i cant place it all here anyways i have a loop and the busloop variable increases by 1 everytime the loop executes
for exmple
busloop=0
for buscombo i=1:36
busloop=busloop +0
arrayA(busloop)=result;
however i observe that arrayA size is much larger than the busloop ?? which is supposed to be 36
and i checked that busloop value is 36
any idea what might be causing this? I know it might be difficult since u dont have the complete code but it is weird
  2 Kommentare
Guillaume
Guillaume am 15 Okt. 2019
Note that in your example code, you don't increase busloop. I assume that the +0 is a typo.
What is the size and type of result?
Mil Shastri
Mil Shastri am 15 Okt. 2019
I noticed multiple issues with the code. Perhaps 'busloop=busloop +0' must be after setting arrayA. Also, it should be 'busloop=busloop +1'. Please see the code below:
result=1;
busloop=1;
for buscombo=1:2
arrayA(busloop)=result;
busloop=busloop +1;
end
arrayA

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 15 Okt. 2019
arrayA=zeros(1,36);
for buscombo=1:36
% Find result...
arrayA(busloop)=result;
end

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by