store repetitive data results
    1 visualizzazione (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
I can't really explain what i want to do, but i will try my best. I have an repetitive form(for) that for every input value it returns an answer after doing a set of operations. What i want is to store every answer into an string that at the ending of all calculations contains all the answers. Sorry but i'm kind new to MATLAB so please be gentle with me. Thanks.
2 Commenti
Risposta accettata
  Andrei Bobrov
      
      
 il 2 Giu 2013
        
      Modificato: Andrei Bobrov
      
      
 il 2 Giu 2013
  
      r = 100;
th = 0:5:180;
c = -5*r^2+2*r^2*sind(thet).^2+2*r^2*((4-5*sind(th).^2+sind(th).^4).^(1/2));
x = cell(numel(th),1);
for jj = 1:numel(th)
    rt = roots([1 0 c(jj)]);
    x{jj} = rt(rt>0);
end
Più risposte (2)
  Image Analyst
      
      
 il 1 Giu 2013
        Like this?
cellArrayOfStrings  = cell(numberOfRuns, 1);
for k = 1 : numberOfRuns
  cellArrayOfStrings{k} = SomeFunctionThatReturnsAString(k)
end
SomeFunctionThatReturnsAString() would be some function you write that returns some output argument as a string.
0 Commenti
Vedere anche
Categorie
				Scopri di più su Characters and Strings in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



