Exporting different types of columns to a tab delimited txt file
Mostra commenti meno recenti
Hello, I have a datafile with one column, and I need to create a txt file (tab delimited) with headers and three columns. Lets call the headers head1, head2 and head3. My data has to follow the next rules:
Under head1 I need to repeat the same string such as: 12/02/2012
Under head2 I need values 0:0.5:depends
Under head3 I need the data from my datafile
what I currently have is :
datalength = length(data) %calculate the number of rows
col1 = cell(lengthdata,1);
col1(:) = {'12/02/2012'} %this creates cells with the date
col2 = ones(lengthdata,1); %create a matrix for values
col3 = col2;
for row=1:datalenght %fill in col2 and col3
col2 = 0.5*row-0.5;
col3(row) = data(row)
end
As you can see I don't know how to join the columns, add the headers and export them to a tab delimited txt file.
Any help would be welcomed
David
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Cell Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!