Replacing a column values of a table?
13 views (last 30 days)
Show older comments
How can i replace a column (values) of a table? How do i use a matlab function to replace a column values??
%% Import data set
allmydata=datastore('E:\DATA folder\Excel sheet');
modeldata1=readall(allmydata);
modeldata2=modeldata1(:,1:19);
modeldata2.Properties.VariableNames={'Sweep','Time','REfCurrent',...
'REfVoltage','REfTemp1','REfTemp2','LSCCurrent','LSCVoltage','LSCTemp1',...
'LSCTemp2','PLSCCurrent','PLSCVoltage','PLSCTemp1','PLSCTemp2',...
'PVCellCurrent','PVCellVoltage','PVCellTemp1','PVcellTemp2',...
'SolarRadiation'};
% Read data sets for LSC current1, voltage1, radiation1,time1,tem1,temp2;
modeldata=sortrows(modeldata2,'Time');
%% Read different data sets
[[time2]=modeldata.Time;
time = datetime(time2,'InputFormat','MM/dd/yyyy HH:mm:ss:SSS',...
'Format','dd/MM/yyyy HH:mm:ss.SSS');
% Replace the 2 column data for date;
modeldata{:,2}=time;
Please, how can i change the second columnof the table 'modeldata' with a new data?
0 Comments
Answers (1)
dpb
on 10 Jul 2020
Replace
[[time2]=modeldata.Time;
time = datetime(time2,'InputFormat','MM/dd/yyyy HH:mm:ss:SSS',...
'Format','dd/MM/yyyy HH:mm:ss.SSS');
% Replace the 2 column data for date;
modeldata{:,2}=time;
modeldata=sortrows(modeldata2,'Time');
%% Read different data sets
[[time2]=modeldata.Time;
with
modeldata2.Time=datetime(modeldata2.Time,'InputFormat','MM/dd/yyyy HH:mm:ss:SSS',...
'Format','dd/MM/yyyy HH:mm:ss.SSS');
modeldata2=sortrows(modeldata2,'Time');
0 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!