フィルターのクリア

different type variables need to be printed to .txt file

2 ビュー (過去 30 日間)
Daniel
Daniel 2014 年 7 月 19 日
コメント済み: Daniel 2014 年 7 月 19 日
Hi,
I have a epoch timestamp variable that has been converted to 'char' type(it is nx20) and a data set that is 'double' type (it is nx1). I can't seem to export these values as columns side by side like below:
time data
a 1
b 2
c 3
Need to save it as a .txt file also...
Anyone know the solution?

採用された回答

Jos
Jos 2014 年 7 月 19 日
This will write the vectors time (n x 20 char) and data (n x 1 double) to the file output.txt with the vectors next to each other
fid = fopen('output.txt','wt');
for i=1:n
fprintf(fid,'%s\t%f\n',time(i,:),data(i));
end
fclose(fid);
Cheers
Joe

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by