Data is not valid NDGRID format

5 views (last 30 days)
Hi Matlab Community,
I'm a new user of Matlab program. I got the error when I used the griddedInterpolant function to interpolate the data, this error is displayed in the below.
In addition, I also attach my controlling script in this post.
Please help me to resolve this problem!
Any suggestions will be appreciated.
Thanks all,
Bests,
Manh,
Error using griddedInterpolant
Data is not valid NDGRID format
Error in
FCr = griddedInterpolant(daplon,fliplr(daplat),fliplr(hs),method);
  10 Comments
Scott MacKenzie
Scott MacKenzie on 4 Jun 2021
Please re-read my comment. Posting "all your material" burdens anyone trying to help you with downloading, unzipping, importing multiple files, etc. I suggest you figure out a way to distill the issue down to something more manageable. It's usually best just to post a single spreadsheet or text data file and some code that accesses that data and demonstrates the issue you are trying to resolve.
Manh Nguyen
Manh Nguyen on 4 Jun 2021
Hi Mr. Scott MacKenzie,
I've changed my script into one file which is attached in this post. And the error in my case is displayed like that:
>> run sample.m
xl =
80.3980
xr =
155.4010
yb =
-11.7401
yt =
33.5703
getting hs tp and dp for 20200601.0000
Error using griddedInterpolant
Data is not valid NDGRID format.
Error in sample (line 50)
FCr = griddedInterpolant(daplon,fliplr(daplat),fliplr(hs),method);
Error in run (line 86)
evalin('caller', [script ';']);
Can you kindly help me to resolve this problem?
Thank you very much!

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Jun 2021
If
FCr = griddedInterpolant(daplon,fliplr(daplat),fliplr(hs),method);
gives you that problem, then the first thing to try is
FCr = griddedInterpolant(daplon.',fliplr(daplat).',fliplr(hs).',method);
  16 Comments
Walter Roberson
Walter Roberson on 8 Jun 2021
Adjusted versions of the files are attached.
Note the new function, read_with_retry . That is called by readww3_2TPAR2 in order to read each different variable more reliably.
This code has not been rewritten to try to read multipe timepoints at the same time. The guiding principle was "get it to work first!"
Manh Nguyen
Manh Nguyen on 9 Jun 2021
Hi Roberson,
Thank you very much for your help.
I've downloaded and run your modified scripts and they can run successfully.
I'd like to say that I'm really appreciate your help.
Thank you again.

Sign in to comment.

More Answers (0)

Categories

Find more on Downloads 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!