I have quite long array 'A' (8760x1) of saved data. From 1 to 8760 (those are hours during a year). I need to set different values for certain hours.
I started from creating a new array 't' which will be set into 24-hour periods (days). Exactly from 0 to 23.
t = [1:8760]';
hours = rem(t,24);
now, what I need to do, is multiply the values (saved in 'A') so that they meet the conditions for specific hours that is:
- 0,2 for hours: 23:00 to 6:00 and 14:00 to 15:00
- 0,5 for hours: 6:00 to 13:00 and 16:00 to 22:00
result = (hours <6)*0.2 + (hours >=14)*0.2 + (hours <15)*0.2 + (hours >=23)*0.2 + (hours >=6)*0.5 + (hours >=16)*0.5
And the result will not work because the intervals intersect. Some ideas?
The final equation will be:
1 Comment
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/648753-how-to-use-multiple-arguments-in-matrix#comment_1135953
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/648753-how-to-use-multiple-arguments-in-matrix#comment_1135953
Sign in to comment.