error in example code

i wanted to try example in Classify Hyperspectral Images Using Deep Learning code in my matlab, but matlab doesn't recognize createImagePatchesFromHypercube function. also i can't run this example here, although you mentiond This function is attached to the example as a supporting file.
could you please help me, thanks.

7 Comments

"To perform hyperspectral image analysis, download the Image Processing Toolbox Hyperspectral Imaging Library from the Add-On Explorer"
it's already installed and only this function is not recognised by matlab. how can i acces to the source code of this function? may you please share it with me. thanks
Unrecognized function or variable 'createImagePatchesFromHypercube'.
Error in CSCNN (line 15)
[allPatches,allLabels] = createImagePatchesFromHypercube(imageData,gtLabel,windowSize);
this is the error
If you already installed it, make sure it's on the search path. Run
which createImagePatchesFromHypercube
If that doesn't solve it, reinstall.
Image Processing Toolbox™ Hyperspectral Imaging Library provides MATLAB® functions and tools for hyperspectral image processing and visualization.Use the functions in this library to read, write, and
@per isaksonper isakson
i did as you said. reinstalled it again and this is what happens 'createImagePatchesFromHypercube' not found. the code doesn't work in here either but with different error this time hypercube function is not recognised. thanks for helping me.
I didn't install the library and cannot see its content.
Use the little envelope icon to Contact MathWorks Image Processing Team. Or report your problems in the Comment thread of the submission.
thanks a lot.
I also encountered the same problem, have you solved it?

Sign in to comment.

Answers (1)

Once the Hyperspectral add-on is installed, then the master copy of that file is at
filename = fullfile(matlabroot, 'examples', 'deeplearning_shared', 'main', 'createImagePatchesFromHypercube.m')
filename = '/MATLAB/examples/deeplearning_shared/main/createImagePatchesFromHypercube.m'
ls(filename)
/MATLAB/examples/deeplearning_shared/main/createImagePatchesFromHypercube.m
This file is not on your MATLAB path, and it is not intended that you use it directly. Instead, you need to
openExample('deeplearning_shared/HyperspectralImageClassificationUsingDeepLearningExample')
which will create a directory for you that holds the example and runs any necessary initialization.

3 Comments

I have tried using the method you provided, but it still doesn't work.
Can you share the function createImagePatchesFromHypercube file?
That .m file can solve all my problems. Thank you sincerely.
What do you see if you
filedir = fullfile(matlabroot, 'examples', 'deeplearning_shared', 'main');
ls(filedir)
Can you share the function
No, my understanding is that it is copyrighted code, and I do not have the authority to make it available to other people.
Jiang Karen
Jiang Karen on 13 Sep 2021
Edited: Jiang Karen on 13 Sep 2021
I think these functions are open source, because these libraries can be downloaded for free.
I also downloaded the toolbox, there may be some bugs.
Other people and I also encountered the same problem.
Hope you can help me. Sincerely.
Email: jklblue@qq.com

Sign in to comment.

Asked:

on 3 Feb 2021

Edited:

on 13 Sep 2021

Community Treasure Hunt

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

Start Hunting!