how to put the obtained 'k' value in a separate array?

1 次查看(过去 30 天)
overload(k)=(abs(pline1(k))-pmax(k))/(pmax(k))*100; overload(k) k
from the above code, we get different values of 'k'. how do we put it into an array? when tried putting into array, have got the error as- subscript indice must either be real positive integer or logicals

回答(1 个)

Ahmed A. Selman
Ahmed A. Selman 2013-4-1
Simply use
D1= overload(k)
If (k) was not a positive integer you cannot use it as a matrix index. It is the function argument tho, and is so it can be any value (unless you specify otherwise). Example:
k=sqrt(3);
y=sin(0:0.1:k);
then (y) will have indices from (1 to 18), but (k) is 1.73 and have nothing to do with size(y) specifically, for if we used ( sin(0:k) ) instead, then (y) will have indices from (1 to 2) only, ..etc. Using
D1(:,:)=overload(k)
might solve the issue you've got- but theoretically it is the same as D1 =...
Or, you can post the functions (pline1, pmax and pmin), perhaps you'll get a more accepted answer from someone else :)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by