Change input user 0 to -1

1 回表示 (過去 30 日間)
Soveatin Kuntur
Soveatin Kuntur 2021 年 5 月 10 日
コメント済み: Soveatin Kuntur 2021 年 5 月 10 日
I want to make some program which required input from user. I want to make the program works this way
for example if user input : x = [1 1 1; 0 1 1; 0 0 0; 1 1 0;] then matlab will automatically change it into x = [1 1 1; -1 1 1; -1 -1 -1; 1 1 -1;] before processing it to some formula

採用された回答

David Fletcher
David Fletcher 2021 年 5 月 10 日
x = [1 1 1; 0 1 1; 0 0 0; 1 1 0;]
x(x==0)=-1
  1 件のコメント
Soveatin Kuntur
Soveatin Kuntur 2021 年 5 月 10 日
Thanks dave!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by