dataset - add a new row and fill in data in a loop

1 回表示 (過去 30 日間)
Megan
Megan 2020 年 2 月 14 日
編集済み: Megan 2020 年 2 月 19 日
Hi guys I want to add a new row into my dataset and want to fill it in with data
Could someone help me?

採用された回答

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2020 年 2 月 14 日
編集済み: JESUS DAVID ARIZA ROYETH 2020 年 2 月 14 日
"The dataset data type is not recommended. To work with heterogeneous data, use the MATLAB® table data type instead"
data=readtable('datasetT.xlsx');
data=[data table(zeros(size(data,1),1),'VariableNames',"orderOfDay")];
data{and(data{:,1}>=1,data{:,1}<=7),end}=1;
data{and(data{:,1}>=8,data{:,1}<=14),end}=2;
data{and(data{:,1}>=15,data{:,1}<=21),end}=3
with dataset (not recommended) :
data = dataset("xlsfile", "datasetT.xlsx");
data=[data dataset(zeros(size(data,1),1),'VarNames',"orderOfDay")];
data(and(double(data(:,1))>=1,double(data(:,1))<=7),end)=dataset(1);
data(and(double(data(:,1))>=8,double(data(:,1))<=14),end)=dataset(2);
data(and(double(data(:,1))>=15,double(data(:,1))<=21),end)=dataset(3)
  1 件のコメント
Megan
Megan 2020 年 2 月 15 日
is there any possibility to do it with a for loop?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by