How to find values fron their location?

2 次查看(过去 30 天)
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);

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by