Replacing a column values of a table?

13 次查看(过去 30 天)
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?

回答(1 个)

dpb
dpb 2020-7-10
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');

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by