Regarding Matrix row subtraction! Please Help, Urgent
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pavel Chatterjee
am 17 Mär. 2018
Kommentiert: Rik
am 18 Mär. 2018
HI
Consider this example
A=[6 5 6;2 4 1] A(2,2)-A(1,2) gives me a zero value. However I needed the real value in positive. I do understand that abs() would help in making it positive however I get a zero value to start with. CAN SOMEONE PLEASE HELP
1 Kommentar
Rik
am 18 Mär. 2018
You should avoid the word urgent. The overwhelming majority of answers and other support provided on this forum is from volunteers. You can improve your chances on a fast answer by following the advice here. If someone reads your question and finds it interesting enough, you will get an answer or at least some pointers to help you along. Using words like urgent or all caps please help don't improve the odds. Actually, some people actively avoid questions with these kind of words.
Akzeptierte Antwort
John D'Errico
am 17 Mär. 2018
Bearbeitet: John D'Errico
am 17 Mär. 2018
Works for me.
A=[6 5 6;2 4 1];
A(2,2)-A(1,2)
ans =
-1
I would suggest that A is probably of class uint8. (Or a similar integer class.) Verify that by whos.
whos A
Name Size Bytes Class Attributes
A 2x3 48 double
You can see that A is a double. See what happens if we change the class of A. It still looks very much the same, but...
A = uint8(A)
A =
2×3 uint8 matrix
6 5 6
2 4 1
A(2,2)-A(1,2)
ans =
uint8
0
Now we get zero.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!