- 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?
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Molly Fort
el 28 de Oct. de 2025 a las 14:14
Respondida: Parth Parikh
el 5 de Nov. de 2025 a las 5:49
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 comentarios
Respuestas (2)
Anmol
el 3 de Nov. de 2025 a las 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 comentarios
Parth Parikh
el 5 de Nov. de 2025 a las 5:49
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 comentarios
Ver también
Categorías
Más información sobre Hyperspectral Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!