How to run my code for selective interval of values?
이전 댓글 표시
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!
답변 (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
댓글 수: 8
Darina
2014년 1월 24일
Amit
2014년 1월 24일
That's what my question was. You said you wanted to include half of the consumption. How do you know when its hot water versus cold water. This part you did not specified in your question.
Darina
2014년 1월 24일
Amit
2014년 1월 24일
so allFileMin(i).demand_pattern1.Wm.total.flowArray, every data point means the amount of water consumption for that point?
Darina
2014년 1월 24일
Amit
2014년 1월 24일
wouldn't 0.5*currentFlowArray will change the water flow at that time into half.
The problem is that there is not a lot of info regarding the machine, when its on, how much water gets used in each cycle etc.
Darina
2014년 1월 24일
Darina
2014년 1월 24일
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
