how to add zero padding to text file to make 250x4

1 回表示 (過去 30 日間)
Jaspreet Kaur
Jaspreet Kaur 2021 年 7 月 14 日
コメント済み: Jaspreet Kaur 2021 年 7 月 14 日
I want to add zeros to make my data eqaully balance with 250 rows and 4 columns. can anyone help?
  1 件のコメント
Rik
Rik 2021 年 7 月 14 日
What is your input data, and what have you tried so far?

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

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 7 月 14 日
編集済み: Sulaymon Eshkabilov 2021 年 7 月 14 日
X = load("Test0.txt"); % Original data file
x1 = zeros(250,4); % Zeros 250-by-4
XX = [x1;X]; % All data augmented
writematrix(XX,'Test_New.txt','Delimiter','tab') % Written a new data file in *.txt
  1 件のコメント
Jaspreet Kaur
Jaspreet Kaur 2021 年 7 月 14 日
Thank you for your reply. actually i have multiple text file. here is example of one of them.

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by