Subtracting in matrix, column to column (Basic MatLab)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
John wick
am 11 Aug. 2019
Kommentiert: John wick
am 11 Aug. 2019
Given a 45×48 matrix, type a single command that subtracts column 36 from column 44
i answered this but it pops up as Error: Invalid use of operator. Is there something wrong or should it be in different type of form.
(:,36)-(:,44)
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Aug. 2019
Your idea is essentially correct. I have no idea what the question wants.
Perhaps providing a matrix and a reference to it will work:
A = rand(45,48);
col_dif = A(:,36)-A(:,44)
6 Kommentare
Weitere Antworten (1)
Image Analyst
am 11 Aug. 2019
Bearbeitet: Image Analyst
am 11 Aug. 2019
You need to put the matrix name in there, and a result variables, like
result = m(:,44) - .....................
etc.
3 Kommentare
Image Analyst
am 11 Aug. 2019
Well you can't just have indexes within parentheses like (:,44), because how could MATLAB possibly know which matrix you're referring to.
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!