Hi
Please I have this function
fnP=@(a,i)(sum(a(i)>a(1:i))+0.5*sum(a(i)==a(1:i)))/i;
and I get generated result for each column
for instance
m1 = fnP(result, 1)
m2 = fnP(result, 2)
m3 = fnP(result, 3)
.
.
.
mn =fnP(result, n)
and so on
I will like a short code that will give me the m results without having to repeat m1, m2, m3 , m4... etc the code for 800 column datapoint
Thanks in advance
Tino

댓글 수: 1

Stephen23
Stephen23 2019년 5월 15일
@Tino: using numbered variables is a sign that you are doing something wrong. It is simpler and much more efficient to use indexing into one array.

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

 채택된 답변

madhan ravi
madhan ravi 2019년 5월 15일

0 개 추천

m=cell(5,1);
for k=1:5
m{k}=fnP(result,k);
end

댓글 수: 3

madhan ravi
madhan ravi 2019년 5월 15일
편집: madhan ravi 2019년 5월 15일
Tino: Why was it accepted mistakenly? Doesn’t work?
Tino
Tino 2019년 5월 15일
Hi Madhan
How do I refer to the cell of m
for instance I want to want to use the code
x = m(: , :) ^ (2 * 5.2)
I am getting the error. Unable to use value of type 'cell' as an index
How do I go about it
thanks in advance
x = [m{:}] .^ (2 * 5.2)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Elementary Math에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

2019년 5월 15일

댓글:

2019년 5월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by