MATLAB Answers


Using regexp on a double array

Asked by Kate
on 24 Jun 2013

I'm trying to extract variable names and years from my file names, but getting an error from regexp.

Example of code:

%Call up files
  fuf(pwd, 'detail');
    %Extract variable names
    pieces = regexp(fn, '\/', 'split');
    driver = p{9};

but I get this error message:

Undefined function 'regexp' for input arguments of type 'double'.

Is there a different function I should be using on double arrays? Thanks!


Walter Roberson
on 25 Jun 2013

Then load() must be replacing "fn".

Put a breakpoint in before the load. Examine class(fn) . "step" past the load. Examine class(fn). Has it changed? What does

which regexp


on 25 Jun 2013

Walter, now I see what you're saying. Perhaps this is a netcdf issue. I wrote this code for .m files and it worked fine, but now my fn is empty when I use it on .nc files. Frustrating.

per isakson
on 25 Jun 2013

Matlab (R2012a) does not have a function, load, which reads NetCDF-files.

Doc says: ncdisp, Display contents of NetCDF data source in Command Window


    ncdisp( '[...]alysis/Met_drivers/sens_heat/') % use full name

and read the documentation on NetCDF


0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!