필터 지우기
필터 지우기

Use of rowfun and varfun

조회 수: 3 (최근 30일)
Niraj Shah
Niraj Shah 2020년 6월 13일
댓글: madhan ravi 2020년 6월 19일
I have a table that looks like this
A B C Var1 Var2 Var3
--- --- ----------- ---- ---- ---
1000 10 'Index' 1 2 3
3000 20 'Index' 2 3 4
5000 30 'NotIndex' 3 4 5
5000 40 'Index' 4 5 6
I want to manipulate Var1, Var2...…based on the the values in A, B and C…I have an exteranl function that does the manipulation needed.
If I use rowfun I can only manipulate one VaR at a time. If I use varfun then I cant figure out how to pass A, B and C
  댓글 수: 3
Niraj Shah
Niraj Shah 2020년 6월 13일
When C = 'Index', then A*B*Var1, A*B*Var2 etc...
else A+B+Var1, A+B+Var2...
so result should be
Var1 Var2
------- -----
10000
120000
5333
madhan ravi
madhan ravi 2020년 6월 19일
Do you see why you didn’t receive a proper answer? More illustrations needed, it’s not clear atleast for me.

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

답변 (1개)

Abhivandan Pandey
Abhivandan Pandey 2020년 6월 14일
Hi Niraj,
You can get multiple output using rowfun as well.
As shown in this link you need a function that returns 3 outputs (Var1,Var2,Var3 in your case).

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by