How to give the name of each column of a matlab file with the data in 8 columns
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dharma Khatiwada
el 28 de Oct. de 2022
Comentada: Pedro Alves
el 27 de Dic. de 2022
whos -file alujasto_10_22_lagi.mat
Hi,
I am trying to give the name of each column of attached .mat file like A, B, C,...... . There are 8 columns of data. Your help will be highly appreciated. Is it going to be the same procedure if I have a .txt file?
Thanks
Dharma
0 comentarios
Respuesta aceptada
Walter Roberson
el 28 de Oct. de 2022
If you need to assign each one to a separate variable (not recommended) then
S = load('alujasto_10_22_lagi.mat');
temp = num2cell(S.alujasto, 1);
[A, B, C, D, E, F, G, H] = temp{:};
Is it going to be the same procedure if I have a .txt file?
T = readtable(YourFileName);
then
T.Properties.VariableNames = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
6 comentarios
Walter Roberson
el 29 de Oct. de 2022
newT = T;
newT.A = newT.A * k;
writetable(newT, filename)
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Import and Analysis 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!