how to fix subscripted assignment dimention mismatch in my coding?
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
clc;
clear all;
close all;
%%input images
im1 = imread('31-0000.jpg') ;
im2 = imread('32-0000.jpg') ;
im3 = imread('33-0000.jpg') ;
im4 = imread('34-0000.jpg') ;
im5 = imread('35-0000.jpg') ;
im6 = imread('36-0000.jpg') ;
im7 = imread('37-0000.jpg') ;
im8 = imread('38-0000.jpg') ;
M(:,:,1) = im1 ;
M(:,:,2) = im2 ;
M(:,:,3) = im3 ;
M(:,:,4) = im4 ;
M(:,:,5) = im5 ;
M(:,:,6) = im6 ;
M(:,:,7) = im7 ;
M(:,:,8) = im8 ;
hf2 = figure ;
hs = slice(M,[],[],1:8) ;
shading interp
set(hs,'FaceAlpha',0.8);
all images are of dimentions 250x306
2 comentarios
Jan
el 28 de Mzo. de 2019
I've formatted your code today. Please use the buttons for formatting in the future. Thanks.
If you post a copy of the complete error message, the readers do not have to guess, where the problem occurs.
Pawan Kumar PS
el 28 de Mzo. de 2019
Respuestas (1)
Jan
el 28 de Mzo. de 2019
The posted code works as expected. Please confirm, that this causes the same problem:
M = rand(250, 306, 8);
hs = slice(M,[],[],1:8) ;
shading interp
set(hs,'FaceAlpha',0.8)
If this does not create the same problem, the difference must be found inside te assignment of M:
M(:,:,1) = im1 ;
M(:,:,2) = im2 ;
...
Either the assumption is wrong, that "all images are of dimentions 250x306". Or the images are RGB images with the dimension [250 x 306 x 3].
7 comentarios
Pawan Kumar PS
el 28 de Mzo. de 2019
Jan
el 28 de Mzo. de 2019
Please post the full code. Now your M is not a single or double, so I guess, that you have converted the image data to uint8. Without seeing the code, I can only guess, what is going on.
Pawan Kumar PS
el 28 de Mzo. de 2019
M = zeros(25, 50, 8);
for k = 1:8
img = imread(sprintf('%d-0000.jpg', k + 30));
img = imresize(img, [25 50]);
img = im2double(rgb2gray(img)); % Convert to double format
M(:, :, k) = img;
end
hf2 = figure ;
hs = slice(M,[],[],1:8) ;
shading interp
set(hs,'FaceAlpha',0.8);
Pawan Kumar PS
el 28 de Mzo. de 2019
Pawan Kumar PS
el 28 de Mzo. de 2019
Pawan Kumar PS
el 28 de Mzo. de 2019
Editada: Pawan Kumar PS
el 28 de Mzo. de 2019
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

