MATLAB Answers


How to save the new data in many text files?

Asked by hanif hamden on 17 Jun 2019
Latest activity Commented on by Rik
on 17 Jun 2019
Can anyone help me.. I have 3 files as attached. I rearranged the data and I want to save it into 3 files again. Can anyone help to solve this matter?
Here is my code.
%% Input data
NF = 3;
data = cell(1,NF);
for i = 1:NF
data{i} = dlmread(A);
% Identify year, month, day, hour, minute, second [Y,M,D,H,Mn,S]
Y = data{i}(1,1); M = data{i}(1,2); D = data{i}(1,3); H = data{i}(1,4); Mn = data{i}(1,5); S = data{i}(1,6);
dt = datetime(Y,M,D,H,Mn,S);
% Identify parameter after 2nd Row
Ts = seconds(data{i}(2:end,1)); lat = data{i}(2:end,2); lon = data{i}(2:end,3); sla = data{i}(2:end,4);
dt = datenum(dt + Ts);
date = datestr (dt);
Files = [cellstr(date) num2cell(lat) num2cell(lon) num2cell(sla)]
save(['testing' num2str(i) '.txt'],'Files')
It seems that the save function does not work.

  1 Comment

on 17 Jun 2019
Unless you have written your own function with the name save, the function will behave as documented. Have you read the documentation?

Sign in to comment.




0 Answers