필터 지우기
필터 지우기

How to switch between two different functions

조회 수: 5 (최근 30일)
Frandy
Frandy 2012년 3월 24일
I am trying to write a function in which i can switch between two different functions called linear & joint, both are an array of six. Now the function only needs to switch when the linear or joint arrays are unchanging. I was thinking about using the switch functions and placing cases but didn't know how to quite implement it. Can anyone help?
  댓글 수: 2
the cyclist
the cyclist 2012년 3월 24일
It does sounds like a switch statement is what you need. I did not understand what you meant by "when the linear or joint arrays are unchanging". Also, I am a bit confused when you say that are functions, but also they are an "array of six". You might want to lay out a bit more detail. Finally, if there is someone who might be able to help you with the English, that might help, too.
Frandy
Frandy 2012년 3월 24일
Ok what I meant was that both the linear and joint function will produce an array of six. So when the output of one function is unchanging the script should switch the current function to the other function, which is dependent on whatever one of the two functions are being used.

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

답변 (1개)

Rick Rosson
Rick Rosson 2012년 3월 24일
switch whichFunction
case isLinear
y = linear(x);
case isJoint
y = joint(x);
end
  댓글 수: 3
Rick Rosson
Rick Rosson 2012년 3월 25일
What questions do you have?
Walter Roberson
Walter Roberson 2012년 4월 29일
Perhaps
case 'isLinear'
and
case 'isJoint'
would be clearer for this purpose.

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

카테고리

Help CenterFile Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by