How to use negative numbers in MatLab

27 ビュー (過去 30 日間)
Mathilde Engell
Mathilde Engell 2015 年 1 月 19 日
編集済み: Thorsten 2015 年 1 月 19 日
I have a command as
grades=[1,2,3,4,5,6,7,8,9;3,4,5,2.5,-1.5,-1.8,-3,8,4;4,3.5,2,6.7,4,8,4,-2,-1] grades=grades' if grades(i,:)<-1.5 gradesFinal(1,i)=-3;
But MatLab does not convert nr. to -3 as it is should. What is wrong?

回答 (1 件)

Thorsten
Thorsten 2015 年 1 月 19 日
編集済み: Thorsten 2015 年 1 月 19 日
Use
grades(grades < - 1.5) = -3;

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by