How to compute the Median Absolute deviation of all values of a matrix on Matlab R2015b
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mehdi Kooli
am 14 Okt. 2022
Kommentiert: Mehdi Kooli
am 18 Okt. 2022
I have a matrix, for exemple :
X = reshape(1:20,[4 5])
and I want to compute the MAD of all the values of this matrix on Matlab R2015b.
I tried to compute it with the online Matlab exemple tester using the command mad_X = mad(X,1,'all') and it gives the result : mad_X= 4
This option 'all' doesn't exist on Matlab R2015b so how can I compute it in this version, I tried the simple command the simple command
mad_X = mad(X,1) but the result isn't a value it's a vector mad_X = 1 1 1 1 1
Any suggestion please
0 Kommentare
Akzeptierte Antwort
Branden Summa
am 14 Okt. 2022
You could use X(:) to return the elements in column order, and then use mad on that new vector
X= reshape(1:20,[4 5]);
mad(X(:),1)
mad(X,1,'all')
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!