Calculates the total difference between two numbers
显示 更早的评论
I want it to calculate the difference between two given numbers.
1 个评论
a = 5;
b = 3;
difference = a-b
回答(1 个)
Guru Kumaresan
2022-11-9
编辑:Guru Kumaresan
2022-11-9
Hi Adam,
I understand that you are trying to find the difference between two numbers. For this purpose, you can use absolute value function available in MATLAB.
Example:
a = 2;
b = 5;
Diff = abs(a-b);
Diff will have the value of 3.
Hope this helps!
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!