필터 지우기
필터 지우기

Brace indexing is not supported for variables of this type

조회 수: 4 (최근 30일)
Mos_bad
Mos_bad 2019년 12월 6일
댓글: Jeremy 2019년 12월 6일
Mu_s and Mu_d are cell. This if statement is part of a function which is called inside of a main for loop. I got the following error when execute the main script.
Brace indexing is not supported for variables of this type.
if Mu_s{scenario,i,j,k}<1.0 && Mu_d{scenario,i,j,k}<7.0
DS{scenario,i,j,k}=0; % no damage
elseif Mu_s{scenario,i,j,k}>1.0 && Mu_s{scenario,i,j,k}<2.0 && Mu_d{scenario,i,j,k}<7.0
DS{scenario,i,j,k}=1; % minor damage state
elseif Mu_s{scenario,i,j,k}>2.0 && Mu_s{scenario,i,j,k}<4.0 && Mu_d{scenario,i,j,k}<7.0
DS{scenario,i,j,k}=2; % moderate damage state
elseif Mu_s{scenario,i,j,k}>4.0 && Mu_s{scenario,i,j,k}<6.0 && Mu_d{scenario,i,j,k}<7.0
DS{scenario,i,j,k}=3; % major damage state
elseif Mu_s{scenario,i,j,k}>6.0 || Mu_d{scenario,i,j,k}>7.0
DS{scenario,i,j,k}=3; % collapse or complete damage state
end

답변 (1개)

Jeremy
Jeremy 2019년 12월 6일
Mu_s{:} < 1.0 && Mu_d{:} < 7.0
  댓글 수: 2
Mos_bad
Mos_bad 2019년 12월 6일
I just editted the question. I need a specific data (i.e. Mu_s{scenario,i,j,k}) of cell array to be considered as you may see in the code above.
Jeremy
Jeremy 2019년 12월 6일
Indexing the cell with curly braces should pull the scalar value and allow you to get a logical result, unless the value contained within the cell is another cell array.

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

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by