Azzera filtri
Azzera filtri

Why does the following function produce error (Index in position 2 exceeds array bounds)?

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
Priyank Goel
Priyank Goel il 12 Lug 2021
Dear Walter,
I was able to read directory
K>> ls(directory)
. scene_0016.bmp scene_0033.bmp scene_0050.bmp
.. scene_0017.bmp scene_0034.bmp scene_0051.bmp
scene_0001.bmp scene_0018.bmp scene_0035.bmp scene_0052.bmp
scene_0002.bmp scene_0019.bmp scene_0036.bmp scene_0053.bmp
scene_0003.bmp scene_0020.bmp scene_0037.bmp scene_0054.bmp
scene_0004.bmp scene_0021.bmp scene_0038.bmp scene_0055.bmp
scene_0005.bmp scene_0022.bmp scene_0039.bmp scene_0056.bmp
scene_0006.bmp scene_0023.bmp scene_0040.bmp scene_0057.bmp
scene_0007.bmp scene_0024.bmp scene_0041.bmp scene_0058.bmp
scene_0008.bmp scene_0025.bmp scene_0042.bmp scene_0059.bmp
scene_0009.bmp scene_0026.bmp scene_0043.bmp scene_0060.bmp
scene_0010.bmp scene_0027.bmp scene_0044.bmp scene_0061.bmp
scene_0011.bmp scene_0028.bmp scene_0045.bmp scene_0062.bmp
scene_0012.bmp scene_0029.bmp scene_0046.bmp
scene_0013.bmp scene_0030.bmp scene_0047.bmp
scene_0014.bmp scene_0031.bmp scene_0048.bmp
scene_0015.bmp scene_0032.bmp scene_0049.bmp
But now the issue is: Unable to perform assignment because the indices on the left side are not
compatible with the size of the right side.
Error in POD_DMD (line 17)
data(:,:,count) =
imread(sprintf('%s/scene_%04d.bmp',directory,count));
Please help as I am not experienced in Matlab.

Accedi per commentare.

Risposte (1)

Priyank Goel
Priyank Goel il 12 Lug 2021
Modificato: Priyank Goel il 12 Lug 2021
Thanks a lot Walter, now I am able to run it.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by