필터 지우기
필터 지우기

how to make reference to a line in matlab?

조회 수: 2 (최근 30일)
Sameer
Sameer 2014년 5월 30일
답변: the cyclist 2014년 5월 30일
can you make a reference to a certain line in MATLAB that will allow you to use it in a loop?
I am trying to use multiple linear equality constraints for fmincon within the loop.
  댓글 수: 1
Image Analyst
Image Analyst 2014년 5월 30일
Do you mean like a "goto" statement, like "goto line #42"?

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

답변 (1개)

the cyclist
the cyclist 2014년 5월 30일
Assuming you mean a GOTO statement, as Image Analyst mentions, then no. But, there are some tricks you can do to effectively define two different constraints in one function. For example, you can encode
fun = @(x,N) ((N==1)*x + (N==2)*x.^2)
so that if you pass N==1, then the function is
fun = x
and if you pass N==2, then it is
fun = x.^2

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by