Why does the following function produce error (Index in position 2 exceeds array bounds)?
Mostrar comentarios más antiguos
Why does the following function produce error-
Index in position 2 exceeds array bounds.
Error in POD_DMD (line 47)
imagesc(reshape(Phi(1:r*c,mode),r,c));axis
image;set(gca,'Ydir','Normal')
close all
figure('name','POD')
subplot(figs,1,1)
imagesc(reshape(Phi(1:r*c,mode),r,c));axis image;set(gca,'Ydir','Normal')
title(['\Phi',sprintf('_%i (u-component)',mode)])
subplot(figs,1,2-d)
if com == 2
imagesc(reshape(Phi(r*c+1:end,mode),r,c));axis image;set(gca,'Ydir','Normal')
title(['\Phi',sprintf('_%i (v-component)',mode)]);
end
Please suggest possible solution.
Thanks!
10 comentarios
Priyank Goel
el 10 de Jul. de 2021
Walter Roberson
el 10 de Jul. de 2021
You read in either no files or else exactly one file. What shows up for count ?
Priyank Goel
el 12 de Jul. de 2021
Editada: Priyank Goel
el 12 de Jul. de 2021
Walter Roberson
el 12 de Jul. de 2021
Editada: Walter Roberson
el 12 de Jul. de 2021
The question is, after you run your code and get no output, what value shows up for count ?
What output do you get if you use
ls(directory)
Priyank Goel
el 12 de Jul. de 2021
Walter Roberson
el 12 de Jul. de 2021
Ah, so if the directory named 4_68_image does not exist inside the current directory, then how do you expect to read files from it?
Priyank Goel
el 12 de Jul. de 2021
Priyank Goel
el 12 de Jul. de 2021
Walter Roberson
el 12 de Jul. de 2021
data(:,:,count) =
rgb2gray(imread(sprintf('%s/scene_%04d.bmp',directory,count))) ;
Respuestas (1)
Priyank Goel
el 12 de Jul. de 2021
Editada: Priyank Goel
el 12 de Jul. de 2021
0 votos
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
