필터 지우기
필터 지우기

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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by