Solution to "Subscripted assignment dimension mismatch" error
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    balsip
      
 el 6 de Oct. de 2016
  
    
    
    
    
    Respondida: James Tursa
      
      
 el 6 de Oct. de 2016
            Hello, I have a loop in which I'm applying the Consolidator function. The Consolidator line contains the error, and naming the successive output files of each iteration is where I'm at a loss.
What I'd like to happen is that for each iteration of the loop, an output vector is created with a sequential suffix (e.g., OCS_d41C_001, OCS_d41C_002, OCS_d41C_003, etc.). Thanks everybody!
    itcount=0;
    dstr=num2str(OCS_d41C);
    for i=1:240:length(hourall);
        itcount=itcount+1;
        [hourallC,strcat('OCS_d41C',dstr,'_',num2str(itcount,'%03i'))]=consolidator(hourall, OCS_d41, 'nanmean', 0);
    end
0 comentarios
Respuesta aceptada
  James Tursa
      
      
 el 6 de Oct. de 2016
        Looks like you are attempting to create a series of variable names with embedded numbers. This is usually a bad idea. Hard to code, hard to read your code, and hard to maintain. See this link for better methods (e.g., cell arrays):
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

