For loop won’t display all 10 images in the subplot
%% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window.%% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window. %% 1.1 – Load and Prepare Data Set
clear;
clc;
B = load(‘images.mat’).image_data’; % Loads image file and transposes
C = mat2gray(B); % Converts images to grayscale
% Loop to generate and display images
for i = 1:10
im = reshape(C(:,i), [37, 50])’; % Reshape and store the image
subplot(10, 1, i); % Create a 10×1 grid of subplots
imshow(im, []); % Display each image with scaling
end
The above turns the colunms of a correctly sized matrix into images. When run I’m only getting 9 images of the neccessary 10. I’m thinking there’s some quirk where the firs column isn’t running but I’m unsure. I’m running it in matlab live in a browser window. for loop MATLAB Answers — New Questions