how to combine the result of 3 loops in one cell array with 2 dimensions?
    10 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    summyia qamar
 am 26 Jan. 2017
  
    
    
    
    
    Bearbeitet: Karsten Reuß
      
 am 26 Jan. 2017
            I run loop over 3 variables
for i=1:64
for j=1:630
for k=1:8
 A='do somthing over (i,j)'
 B='do something with A over (k)
end
end
end
I want B to store values of all loops(i,j,k) but dimension of B should be(i,(jxk))..Is it possible to do this or any guidance that after running all loops I can sort the resultant in that dimensions? Actually I want resultant on each value of variable(i)
0 Kommentare
Akzeptierte Antwort
  Karsten Reuß
      
 am 26 Jan. 2017
        
      Bearbeitet: Karsten Reuß
      
 am 26 Jan. 2017
  
      If I understand your question correctly it can be done like this: You can rearrange the dimenstions of B after the loops with commands like reshape for instance. But all your values will be stored. A doesn't have to be within the k-loop as it isn't altered there.
 for i=1:64
for j=1:630
   A(i,j)='do somthing over (i,j)'
for k=1:8
 B(i,j,k)='do something with A (i,j) over (k)
end
end
end
B2=reshape(B,[size(B,1),size(B,2)*size(B,3)]) % or any other variation you like
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Logical finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

