title: Nested loop in MATLAB
body: <p>loop1 start</p>
  
  <p>loop2 start</p>
  
  <p>loop3 start</p>
  
  <p>X</p>
  
  <p>end loop3</p>
  
  <p>end loop 2</p>
  
  <p>end loop 1</p>
  
  <p>Can I store the value of X such that I can see all the values after execution of all the loops? Just mentioning X is text strings.</p>
  
  <p>Update: it's working,. I'm getting an output like:</p>
  
  <pre><code>       {790x1 cell}
            []
            []
            []
            []
            []
            []
            []
            []
            []
  </code></pre>
  
  <p>I guess, all my strings are saved in the {790x1 cell}. Is there any way to see them? The code:</p>
  
  <pre><code>X_record=cell(10000,1);
  c=1;
  for k=1:200
      for i=1:300
          for it=1:200
             X='NY is crowded';
             X_record{c}=X;
             c=c+1;
          end
      end
  end
  </code></pre>
  
  <p><strong>EDIT:2</strong></p>
  
  <pre><code>clear all
  clc
  
  X_record=cell(10,1);
  c=1;
  
  for k=1:2
      for i=1:3
          for it=1:2
             X='NY is crowded';
  
             f_id=fopen('c.txt','a+');
             fprintf(f_id,'%5s\n',X) ;%#ok&lt;CTPCT,CTPCT&gt;
             fclose(f_id)
  
             X_record{c}=X;
             c=c+1;
          end
      end
  end
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <p>NY is crowded
      NY is crowded NY is crowded NY is crowded NY is crowded NY is crowded.....</p>
  
  <p><strong>Why am I not getting any new line?</strong></p>