Wants to add each iteration data in the next column.
    1 view (last 30 days)
  
       Show older comments
    
    shobhit pipil
 on 6 Feb 2020
  
    
    
    
    
    Edited: shobhit pipil
 on 11 Feb 2020
            x=rch;
flow=rch(:,8);
c=0; 
for i=1:166 %c=c+1
    for c=c+1 %c<166
        ind1 = rch(:,2) == c;
        flow_out2= flow(ind1);
    end
    % xlswrite('out.xlsx', flow_out2','A1:FJ2191')
    flow_out2 = [flow_out2 dataToAppend];
end
8 Comments
  Rik
      
      
 on 6 Feb 2020
				First write the contents of your loop. What is the code you want to run for a single iteration? Only then should you start with putting a loop around that.
As for your last question: try to think what you are saying with that line. You are telling Matlab to create a vector (c+1) and run the code inside the loop for each element, using c as the variable to store the elements in. While that is valid code, it is probably not what you mean.
Have you considered doing a tutorial to get up to speed with the basic Matlab syntax?
Accepted Answer
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
