- Figure out why there are NaNs and replace them (manually, smoothing, interpolation, etc)
- Ignore the NaNs: S = std(___,nanflag)
'Value' must be double scalar within the range of 'Limits'
9 views (last 30 days)
Hi. I am creating a gui on appdesigner. I am reading numeric data from a csv file and storing this data in an array. I want to calculate the standard deviation of the values store in the array and display it on the numeric edit field. The error I get is 'Value' must be a double scalar within the range of 'Limits'. But my Limit of the editfield is -Inf,Inf. The csv file is attached and the code is provided below. Please assist.
I tried editing the code to :
But the error still pops up.
Adam Danz on 16 Jun 2022
Edited: Adam Danz on 16 Jun 2022
Your data contains a NaN value.
n = sum(isnan(col_vec));
fprintf('There are %d NaN values in col_vec\n', n)
Where is the NaN value?
nanLoc = find(isnan(col_vec));
fprintf('NaN in row %d', nanLoc)
When there is at least 1 NaN in a vector, std will return NaN.
sd = std(col_vec,'omitnan')