フィルターのクリア

How to define numerical variable names in a loop

1 回表示 (過去 30 日間)
Tasi
Tasi 2023 年 5 月 12 日
コメント済み: Tasi 2023 年 5 月 12 日
I have a variable with dimension 44 x 59 which I would like to display in a table. I want the row names to be years from 1979 to 2022, and variable names to be days in January and February (skipping the leap year), in a format of 1/1, 1/2.... ending in 2/28. How do I define the row names and variable names for this particular case?
  4 件のコメント
Torsten
Torsten 2023 年 5 月 12 日
編集済み: Torsten 2023 年 5 月 12 日
And what's the problem if you use M(i,j,k) for the i'th day in the j'th month of the k'th year, e.g. ?
Tasi
Tasi 2023 年 5 月 12 日
I was trying various ways to define them in a loop but unsuccessfully,

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

採用された回答

Walter Roberson
Walter Roberson 2023 年 5 月 12 日
jan_names = "1/" + (1:31);
feb_names = "2/" + (1:28);
varnames = [jan_names, feb_names];
rownames = string(1979:1979+size(YourArray,1)-1);
T = array2table(YourArray, 'VariableNames', varnames, 'RowNames', rownames);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by