How to change the name of variables inside a file.mat?
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Pietro N
 el 1 de Dic. de 2021
  
    
    
    
    
    Comentada: Pietro N
 el 1 de Dic. de 2021
            Hi,
I have a file called data.mat in which there are 2 variables called t and C (where C size is 18x6, while t size is 18x1; I want to change their name into texp and Cexp and then save the file.mat with the same name (but with the new name variables inside)
How can I do?
0 comentarios
Respuesta aceptada
  Yongjian Feng
    
 el 1 de Dic. de 2021
        How about this?
t=100;C=80; % your data
save('data.mat', 't','C');
clear;
load('data.mat'); %load it first
texp=t; Cexp=C;
save('newdata.mat', 'texp', 'Cexp');
movefile('newdata.mat', 'data.mat'); % replace the old data.mat with the newdata.mat
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!

