How to run my code for selective interval of values?
2 次查看(过去 30 天)
显示 更早的评论
I have got washing machine to predict hot water consumption which is to be translated in energy use. So far I have got a code that goes through washing machine water consumption of 28 households. But I want to exclude the cold water consumption for rinsing.
Here is the code:
results=zeros(86401,1); % plot in seconds for activity 4. Washing machine
for i=1:28,
currentFlowArray=allFileMin(i).demand_pattern1.Wm.total.flowArray;
for p=1:86400,
results(p)=results(p)+ currentFlowArray(p);
end
end
So I want to exclude the second half of the values (assuming it is for cold water) in:
allFileMin(i).demand_pattern1.Wm.total.flowArray
How is this possible?
Thanks!
2 个评论
回答(1 个)
Amit
2014-1-24
Do you mean something like this:
results=zeros(86401,1); % plot in seconds for activity 4. Washing machine
for i=1:28,
currentFlowArray=allFileMin(i).demand_pattern1.Wm.total.flowArray;
% Actually the looping can be omitted
% for p=1:86400/2 % Divide by half
results(1:86400/2)=results(86400/2)+ currentFlowArray(86400/2);
%end
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biological and Health Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!