フィルターのクリア

Append to exisintg file column-wise, different number of rows, don't add NaNs

2 ビュー (過去 30 日間)
newbie9
newbie9 2019 年 2 月 10 日
編集済み: newbie9 2019 年 2 月 10 日
I'm trying to append a table column-wise (with specific column names, so not a matrix) to an existing TXT. The existing file has fewer rows than the appended dataset. I don't want a bunch of NaNs to be added to square-out the dimensions. (The number of rows and columns is much bigger than in this example, so the NaNs actually add a bunch of space and load time.) My code attemp is below, annotated with where I am stuck. Thanks for any help
data = rand(100,2);
data = array2table(data);
% I have a pre-determined list of column names for this table; code skipped here for simplicity
writetable(data, 'myExistingTable.txt');
data2append = rand(250,6);
data2append = array2table(data2append);
% I have a pre-determined list of column names for this table; code skipped here for simplicity
fid001 = fopen('myExistingTable.txt','a');
% below isn't right
fprintf(fid001,'%f %f %f %f %f %f',data2append);
fclose all;

回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by