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

1 vue (au cours des 30 derniers jours)
newbie9
newbie9 le 10 Fév 2019
Modifié(e) : newbie9 le 10 Fév 2019
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;

Réponses (0)

Catégories

En savoir plus sur Numeric Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by