how do you insert a image into another one row and column

hi i am looking for a answer, i am making a calendar and i have done the layout now i am trying to add the weekdays and numbers for days. the images are set to the correct sizes but the problem i am having is getting the images to sit in the correct spaces. how do i load the images in without it coming up as a separate one? i have tired -
f=imread("monday.bmp");
which is the name of the first week day
all my images are in the matlab folder.
i then tired to set the row and column for the image but i just get a error with the code
f(351:370,1:60)=monday;
i am doing something wrong and i have been doing this for hours all i can get is the image to show at the top of the image the other image and i also get the error message use a different letter than f as its already been used?
any help would be appreciated :)

Answers (2)

monday = imread("monday.bmp");
f(351:370, 1:60, :) = monday;
You need to be consistent about whether the image is to be RGB (3D) or grayscale; you might need to convert some grayscale images to RGB to match.
For example if the monday image were grayscale but f were rgb then
monday = imread("monday.bmp");
monday = repmat(monday, [1 1 3]); %convert grayscale to RGB
f(351:370, 1:60, :) = monday;

Asked:

on 26 Mar 2022

Answered:

on 26 Mar 2022

Community Treasure Hunt

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

Start Hunting!