Creation of a text file with a series of record set

1 回表示 (過去 30 日間)
Chandra Bhushan
Chandra Bhushan 2019 年 7 月 25 日
編集済み: per isakson 2019 年 7 月 25 日
I want to give Number of record as N= 100 so that , in a txt file the follwing tempates is written 100 times by automatcially
changing the corresponding serial numbers for the values of each item.
The sample one record is as below:
One Sample
********************************************************
Patient ID : H00001
Patient Name : Name00001
Hospital Name : Hos001
Reffered By : Dr. Doctor001
Diease Symptom : Diease001
Remark : He is Suffereing from Diease 001

採用された回答

per isakson
per isakson 2019 年 7 月 25 日
編集済み: per isakson 2019 年 7 月 25 日
Try
cssm1()
dbtype test.txt 1:14
where
function cssm1()
fid = fopen( 'test.txt', 'w' );
assert( fid >= 3 )
for jj = 1 : 100
fprintf( fid, '********************************************************\n');
fprintf( fid, 'Patient ID : H00%03d\n', jj );
fprintf( fid, 'Patient Name : Name00%03d\n', jj );
fprintf( fid, 'Hospital Name : Hos%03d\n', jj );
fprintf( fid, 'Reffered By : Dr. Doctor%03d\n', jj );
fprintf( fid, 'Diease Symptom : Diease%03d\n', jj );
fprintf( fid, 'Remark : He is Suffereing from Diease %03d\n', jj );
end
fclose( fid );
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by