フィルターのクリア

how to store the data in table after running if loop

2 ビュー (過去 30 日間)
Ram Basnet
Ram Basnet 2021 年 5 月 3 日
回答済み: Cris LaPierre 2021 年 5 月 3 日
clear
data = readtable("hourlyrate_electricity.csv")
data1 = data.GB_GBN_price_day_ahead;
data2= data.GB_GBN_load_actual_entsoe_transparency;
dates_extracted1 = data.utc_timestamp;
dates_extracted = [data.utc_timestamp];
dates= cell2table(dates_extracted);
dates1= datetime(dates.dates_extracted,"InputFormat","uuuu-MM-dd'T'HH:mm:ssZ", "TimeZone", "Z");
c= datenum(dates1);
dm= table(data1, data2,c);
dm2= table2array(dm)
ReplacedmissingValue= standardizeMissing(dm2,0);
display(ReplacedmissingValue)
x= rmmissing(ReplacedmissingValue)
datesbb= x(:,3);
b= datetime(datesbb,'ConvertFrom','datenum');
price= x(:,1);
used_data= table(b,price)
rows_price= height(used_data);
for i=1:rows_price
isa=(used_data.b.Hour==8)
if any(isa)
eight_date=used_data{i,1};
eight_price=used_data{i,2};
end
end
  1 件のコメント
Ram Basnet
Ram Basnet 2021 年 5 月 3 日
i wanna store all the data from the table which satisfy if condition but i end up just storing the last dataset of the loop.

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

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 5 月 3 日
You need to assign the results from each look to a matrix. See this example.
You can learn more about for loops in Ch 13 of MATLAB Onramp.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by