How to find values fron their location?

조회 수: 2 (최근 30일)
Mohammad Sulaiman Stanekzai
Mohammad Sulaiman Stanekzai 2019년 7월 6일
댓글: Walter Roberson 2019년 7월 8일
In the following coding i am able to find the loction of values in "elseif" command but i cant find their values. Please help me.
Thanks in advance.
sym x;
sym y;
sym n;
sym z;
sym b;
pv = xlsread('POWER PV');
p = size (pv,1);
load = xlsread('LOAD');
pemfc = xlsread('PEMFC 1');
l = size (pemfc,1);
for sun = 1:1:p j = 1:1:l ;
if load(sun,1) < pv (sun,1);
x = pv(sun,1)-load (sun,1);
elseif load(sun,1) > pv (sun,1);
y = load(sun,1) - pv (sun,1);
z = find (pemfc(j,1)> y ,1); % it just shows the location of values. I also need thier values but i cant find it.
x = -z;
else
x = 0;
end
n(sun,1) = double (x)
end
  댓글 수: 3
Shameer Parmar
Shameer Parmar 2019년 7월 8일
So as you are saying that the 'z' is location of values then you can find the value at z location as..
x = pv(z,1);
OR
x = load(z,1);
Walter Roberson
Walter Roberson 2019년 7월 8일
What is the intention of
for sun = 1:1:p j = 1:1:l ;
?

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by