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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by