フィルターのクリア

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 Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by