Horzcat function error.

조회 수: 2 (최근 30일)
Maksym Tkachuk
Maksym Tkachuk 2020년 1월 30일
댓글: Subhadeep Koley 2020년 2월 3일
% HW1 Part 1
im1=imread('img1.jpg','jpg');
im2=imread('img2.gif','gif');
im3=imread('img3.png','png');
a=170;b=320;
im1s=im1(a:a+255, b:b+255,:);
c=20;d=220;
im2s=im2(c:c+255, d:d+255,:);
im3s=im3(a:a+255, b:b+255,:);
% Display the images on a single graph
figure(1);
subplot(2,2,1);
imagesc(im1s);
subplot(2,2,2);
imagesc(im2s);
subplot(2,2,3);
imagesc(im3s);
% Merging into one large matrix
newIm = [im1s im2s; im3s zeros(256,256,3)];
figure(2);
imagesc(newIm)
When I run the code I receive the following, "Error using horzcat. Dimensions of arrays being concatenated are not consistent." The goal is to display the images on a single graph and repeat by merging the matrices into one large matrix.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 1월 30일
Check whether im1, im2, im3 are all 3 dimensional.
Subhadeep Koley
Subhadeep Koley 2020년 2월 3일
@ Maksym Tkachuk Can you provide the img1.jpg, img2.gif, and img3.png as attachments?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by