필터 지우기
필터 지우기

Operands to the || and && operators must be convertible to logical scalar values.

조회 수: 7 (최근 30일)
Dear All The code that I am working with is separated to sections with function command. After running the code with input parameters this error occurs. (Operands to the and && operators must be convertible to logical scalar values) However, when I insert the values of the parameters inside the code, then running it , I found it is running. I don't want to insert the parameters values in the code directly ,I want to feed the parameters as input as follow: WaRa(1, 9.81, 0.017, 0, 8.8, 15.2, 1, 1, 0, 0, 2, 4, 0, 36.9, 15.2) any suggestion please?

채택된 답변

Thomas
Thomas 2012년 4월 18일
try using
| and &
instead of
|| and &&
since the && is the Short-circuit logical AND while the & operator is element wise logical and.. which might be what you need.. Cannot say with certainty without looking at the code..

추가 답변 (1개)

Bestun
Bestun 2012년 4월 18일
Dear Thomas As you suggested , when I run it again, now it asking me about the value of the variable (a). As I explained in the previous message , I don't want to insert the parameters in the code directly. I want to inter their values as input: here is a part of my code: if (flag ==0 ||flag ==1) global rw a Yw rd rsat; dlor(rw, a, Yw, rd, rsat,xmax, ymax, edgeA, edgeB, edgeC, edgeD, cohesion, phiDegs, unitWeight); else if (flag ==2) runtests (68.198, 0.5, 0.3, 0.2, 0.7, 1.2, 0.750821238038765, 1.077, 9.81, 0.00001, 8.8, 15.2, 2); end end dlor is a separate function . In dlro values of rw, a, Yw, rd, rsat are required . However, the code is stopped at dlor line (showing above )asking for (a) value.
How can I solve this problem with out inserting the parameter values in the code directly? Do you think , the error is because of using ( global rw a Yw rd rsat;)?

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by