Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do I solve this error "Index exceeds matrix dimensions."

2 visualizaciones (últimos 30 días)
Chidiebere Ike
Chidiebere Ike el 20 de Oct. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello,
Corrections where made on the codes via the comments but I still have errors when I made the suggested corrections and applied the code in my proposed algorithm. The error reads below:
Index exceeds matrix dimensions.
Error in FAST_NLM_II (line 54)
SqDist =
Sd(PatchSizeHalf+WindowSizeHalf+1:Height+WindowSizeHalf+PatchSizeHalf,PatchSizeHalf+WindowSizeHalf+1:Width+WindowSizeHalf+PatchSizeHalf)...
% lower right corner
I will appreciate contributions.
Thank you

Respuestas (1)

Image Analyst
Image Analyst el 20 de Oct. de 2018

Break it down into smaller parts

whos Sd
[rows, columns] = size(Sd)
index1 = PatchSizeHalf+WindowSizeHalf+1
index2 = Height+WindowSizeHalf+PatchSizeHalf
index3 = PatchSizeHalf+WindowSizeHalf+1
index4 = Width+WindowSizeHalf+PatchSizeHalf

Now, is index2 bigger than rows, or index4 bigger than columns?

  2 comentarios
Chidiebere Ike
Chidiebere Ike el 20 de Oct. de 2018
Editada: Image Analyst el 20 de Oct. de 2018
Thanks for your response. NO, index2 is not bigger than rows, or index4 is not bigger than columns as seen below. To obtain the below information, I replaced breakdown in Line 56 on the original code attached.
whos Sd
[rows, columns] = size(Sd)
index1 = PatchSizeHalf+WindowSizeHalf+1
index2 = Height+WindowSizeHalf+PatchSizeHalf
index3 = PatchSizeHalf+WindowSizeHalf+1
index4 = Width+WindowSizeHalf+PatchSizeHalf)
Name Size Bytes Class Attributes
Sd 522x522 2179872 double
rows =
522
columns =
522
index1 =
7
index2 =
518
index3 =
7
index4 =
518
Here is an error obtained. I have attached the original code
Undefined function or variable 'SqDist'.
Error in FAST_NLM_II (line 64)
w = exp(-SqDist/(2*Sigma^2));
Thanks
Image Analyst
Image Analyst el 20 de Oct. de 2018
Then I have no idea why it says an index is out of bounds. You'll have to dig further.
What arguments did you pass in to the function?
It's saying SqDist is an unknown function because line 54 did not execute and define it. I'm not sure how it made it down to line 64 unless line 54 was in an if block that didn't execute. This link should help with that http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by