Clear Filters
Clear Filters

what is the problem of my 'for loop' in a matrix?

2 views (last 30 days)
I'm trying to define some parameters using for loop in a matrix but all the time I have the following error:
i =
1
Undefined function 'isnan' for input arguments of type 'struct'.
My script is:
clear; close all
inpt=importdata('fw12.xlsx');
wave=inpt.data;
cols=size(wave,2);
lenght=size(wave,1);
if i=1:lenght
i
scan=wave(i,:);
dist=scan(8:cols);
rm=isnan(dist);
a=find(rm == 0);
f=dist(a);
[meanf,stdf,meanf95,std95] = normfit(f);
summart(i,1)=meanf;
summart(i,2)=stdf;
summart(i,3)=meanf95(1);
summart(i,4)=meanf95(2);
summart(i,5)=std95(1);
summart(i,6)=std95(2);
end
Any Suggestion to handle this problem?

Accepted Answer

David Sanchez
David Sanchez on 17 May 2013
You are using a struct as input variable for isnan function. This isnsn does not work with structs. Follow your code upwards and you will find out that your dist variable is a struct:
inpt -> wave -> scan -> dist
Redifine your variables in order to send a non-struct to isnan.
  1 Comment
Ashraf Afana
Ashraf Afana on 17 May 2013
That's fine, but to return my variable 'dist' from structs to matrix I need the function 'struct2dataset', which is available in R2013a and I have R 2012a. So, my next question will be, how can I obtain the 'struct2dataset' function? or how can resolve this problem? Thanks,

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays 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!