How to calculate coefficient of variation for every element in Matrix?
Show older comments
Hi,
I'm trying to calculate coefficient of variation for every elemnt in an array but I kept getting this error:
Error using reshape
Product of known dimensions, 521250, not divisible into total number of elements, 1.
here is my code:
(datan) is my raw data with the length of 521250
tm= ceil(length (datan));
mn= mean(reshape([datan(:)],tm,[]));
sd=std(reshape([datan(:)],tm,[]));
cv=reshape((sd./mn)*100,[],tm);
Any help would be appreciated. Thanks in advance!
Answers (1)
David Hill
on 2 Aug 2021
cv=std(datan,0,'all')/mean(datan,'all');
1 Comment
Saad Alqahtani
on 2 Aug 2021
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!