Replacing a column values of a table?

17 ビュー (過去 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');

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by