フィルターのクリア

How to give the name of each column of a matlab file with the data in 8 columns

5 ビュー (過去 30 日間)
whos -file alujasto_10_22_lagi.mat
Name Size Bytes Class Attributes alujasto 10000x8 640000 double
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

採用された回答

Walter Roberson
Walter Roberson 2022 年 10 月 28 日
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?
See readtable. If the columns do not already have headers, then after you do
T = readtable(YourFileName);
then
T.Properties.VariableNames = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
  6 件のコメント
Walter Roberson
Walter Roberson 2022 年 10 月 29 日
newT = T;
newT.A = newT.A * k;
writetable(newT, filename)
Pedro Alves
Pedro Alves 2022 年 12 月 27 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by