- You can try running this example https://www.mathworks.com/help/releases/R2024b/images/ref/spectralmatch.html based on the version of MATLAB you are using.
- You can also try using “hcube.DataCube” instead of datacube = gather(hcube) in the code, as it might be possible the conversion is happening incorrectly.
issue in spectralMatch or am I doing something wrong?
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
on the page for use of spectralMatch function this code is suggested:
score = spectralMatch(libData,hcube);
bw = score < threshold;
datacube = gether(hcube);
T = reshape(datacube,[size(datacube,1)*size(datacube,2) size(datacube,3)]);
Ts = zeros(size(T));
Ts(bw == 1,:) = T( bw==1 ,:);
Ts = reshape(Ts,[size(datacube,1) size(datacube,2) size(datacube,3)]);
but when run, error code pops up;
Unable to perform assignment because value of type 'hypercube' is not convertible to 'double'.
Caused by:
Error using double
Conversion to double from hypercube is not possible.
0 commentaires
Réponses (2)
Anmol
le 3 Nov 2025 à 7:47
Hi Molly,
I understand that you are trying to run the example provided in https://www.mathworks.com/help/releases/R2025b/images/ref/spectralmatch.html for “spectralMatch” function on MATLAB R2024b and while running the code script you are getting this error.
For possible workarounds,
Documentation link: https://www.mathworks.com/help/releases/R2024b/images/ref/spectralmatch.html
I hope you find this useful.
0 commentaires
Parth Parikh
il y a environ une heure
Hi Molly,
Thank you for bringing this issue. I’ve tested the spectralMatch example, and it appears to be running correctly on my end. To assist you further, could you please provide more details about how your hcube object was created? Additionally, which version of MATLAB are you currently using? Assuming that gether(hcube) is a typo. These information will help me give you a more precise answer.
Just to note that if you are using gather(hcube) in MATLAB versions R2024b or earlier, you might encounter issues because data retrieval was handled via hcube.DataCube in those versions.
0 commentaires
Voir également
Catégories
En savoir plus sur Hyperspectral Image Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!