How to read and save different variables in a matfile to another mat file
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    sachin k p
 el 21 de Sept. de 2018
  
    
    
    
    
    Comentada: sachin k p
 el 25 de Sept. de 2018
            How to read two specific variables from a .mat file having different variables and save it to another .mat file without changing the variable name.
0 comentarios
Respuesta aceptada
  Stephen23
      
      
 el 21 de Sept. de 2018
        
      Editada: Stephen23
      
      
 el 21 de Sept. de 2018
  
      S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S')
OR
S = load('file1.mat');
save('file2.mat','-struct','S','var1','var2')
5 comentarios
  Stephen23
      
      
 el 24 de Sept. de 2018
				@sachin k p: if the names are different then you could try the '-append' option, like this:
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S','-append')
Más respuestas (0)
Ver también
Categorías
				Más información sobre Workspace Variables and MAT Files 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!