Data is not valid NDGRID format.

I would like to know what does it mean "Data is not valid NDGRID format" when I try to use interpn() function to interpolate a function from four variables. I've already checked, a dozen times, my matrixes dimensions. Which one of them agrees in size (4D - 2x11x4x3). Besides, there is no way I can use ndgrid() function to create the mesh, in this case I did this mannualy.
If I have all the function values for which one of the variables, why this error appears?
Thanks in advance,

 採用された回答

dpb
dpb 2014 年 8 月 13 日
編集済み: dpb 2014 年 8 月 13 日

0 投票

From the doc for interpn one finds...
"interpn requires that X1,X2,X3,etc. be monotonic and plaid (as if
they were created using NDGRID). X1,X2,X3,etc. can be non-uniformly
spaced."
So, it doesn't matter about the dimension so much, only that the Xn vectors/arrays be monotonic and non-repeating such that they are valid for ndgrid. That you say "there is no way I can use ndgrid() function to create the mesh" pretty much means you can't use interpn to interpolate the data, either (actually, it means it flat out, not just "pretty much" :) ).
You can try some of the other interpolation methods.
Why, specifically, can't you use ndgrid? What is a (smallish) typical subset of the data grid for looksies?

5 件のコメント

Victor
Victor 2014 年 8 月 13 日
The problem is solved, but this is awkward... I did exactly what the function ngrid() does, but mannualy.
I checked and I noticed that my previous matrixes were exactly the same as the matrixes generated by the ndgrid function, but the fact that I didn't use the ngrid function to generate them caused the problem.
Anyway, I found a way to use the ndgrid function and it did work.
Thanks,
dpb
dpb 2014 年 8 月 13 日
...my previous matrixes were exactly the same as the matrixes generated by the ndgrid function, but the fact that I didn't use the ngrid function to generate them caused the problem.
I don't believe that for a minute! :) I'm sure it looks like that, but I'm certain there's something different in the two cases. Matlab doesn't "know" from whence a set of arrays came; all it knows is whether the input meets the input checks run to validate inputs or not and your inputs didn't.
Unfortunately, W/O actual code/data, no way to tell exactly what the mismatch was...
Colton Fruhling
Colton Fruhling 2017 年 10 月 5 日
I have a similar issue that I cannot use ndgrid. I have 3D data where I only want to interpolate along the pages ( 3rd dimension). Slicing the matrix can take considerable time so I thought interpn could essentially parallelize it. But the time points where I have the data are not the same for each page and thus I cannot use ndgrid. Any help would be most appreciated.
dpb
dpb 2017 年 10 月 5 日
I suggest instead of a comment to a closed question that you post this as new question and supply a (small!) dataset that illustrates the problem.
Colton Fruhling
Colton Fruhling 2017 年 10 月 5 日
ok thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

質問済み:

2014 年 8 月 13 日

コメント済み:

2017 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by