필터 지우기
필터 지우기

Using regexp on a double array

조회 수: 1 (최근 30일)
Kate
Kate 2013년 6월 24일
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
pwd
fuf(pwd, 'detail');
fn=fuf(['/Users/katharynwoods/Documents/MATLAB/Research/MATLAB/flux_sensitivity_analysis/Met_drivers/sens_heat/*shtfl.nc*'],'detail');
load(char(fn{1}));
%Extract variable names
pieces = regexp(fn, '\/', 'split');
p=pieces{1};
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!
  댓글 수: 9
Kate
Kate 2013년 6월 25일
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
per isakson 2013년 6월 25일
편집: per isakson 2013년 6월 25일
Matlab (R2012a) does not have a function, load, which reads NetCDF-files.
Doc says: ncdisp, Display contents of NetCDF data source in Command Window
Try
ncdisp( '[...]alysis/Met_drivers/sens_heat/shtfl.1902.nc') % use full name
and read the documentation on NetCDF

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by