Replacing a column values of a table?

13 Ansichten (letzte 30 Tage)
Alexander Abadom
Alexander Abadom am 10 Jul. 2020
Beantwortet: dpb am 10 Jul. 2020
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?

Antworten (1)

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

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by