Replacing a column values of a table?

조회 수: 13 (최근 30일)
Alexander Abadom
Alexander Abadom 2020년 7월 10일
답변: dpb 2020년 7월 10일
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