필터 지우기
필터 지우기

Compare array value to variable value

조회 수: 2 (최근 30일)
Avery-Ryan Ansbro
Avery-Ryan Ansbro 2022년 3월 12일
답변: Jan 2022년 3월 12일
I want to compare changing values in a loop I generated. When I try, I get the error Operator '>' is not supported for operands of type 'cell'. Am I calling individual array elements wrong and, regardless, how do I get past this?:
array ={1,3};
x=2;
if x > array(1) && x< array(2)
%do task
end

채택된 답변

Jan
Jan 2022년 3월 12일
if x > array{1} && x < array{2}
You need curly braces instead of round parentheses. array(1) is a {1 x 1} cellm while array{1} is the contents of the first cell.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by