month to hour ?

조회 수: 5 (최근 30일)
MUNKHBOLOR BAIGALI
MUNKHBOLOR BAIGALI 2020년 10월 5일
댓글: MUNKHBOLOR BAIGALI 2020년 10월 5일
hi
Do you know this code mean? I did not understood this code?
I try to run. This not work. 1 month is 720 hours.
tamb=[25.50 25.70 26.10 26.50 26.60 26.30 26.00 26.00 26.10 26.30 26.10 25.70];%ambient temperature
a=0;
for i=1:1:12
for k=1:1:720
b(k)=tamb(i);
end
a=[a,b];
end
This code is each month tamb's value convert to hour's tamb? is this right? but not work

답변 (1개)

Walter Roberson
Walter Roberson 2020년 10월 5일
a = repmat(tamb, 720, 1);
The result would be 720 x 12 .
  댓글 수: 1
MUNKHBOLOR BAIGALI
MUNKHBOLOR BAIGALI 2020년 10월 5일
thank you for replying Sir
But
tamb=[25.50 25.70 26.10 26.50 26.60 26.30 26.00 26.00 26.10 26.30 26.10 25.70];%ambient temperature
a=0;
for i=1:1:12
for k=1:1:720
b(k)=tamb(i);
end
a=repmat(tamb, 720,1);
end
I runned. but
Index exceeds the number of array elements
Error in Untitled2 (line5)
b(k)tamb(i)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by