Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4076838
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:28:33+00:00 2026-05-20T17:28:33+00:00

The objective is to combine 3 equal sized images(512*512*3) into a resultant image E

  • 0

The objective is to combine 3 equal sized images(512*512*3) into a resultant image E whose size is r= 1536 c =512 d=3

img1=imread('pic1.jpg');
img2=imread('pic2.jpg');
img3=imread('pic3.jpg');

figure;
E = [img1; img2; img3];
imshow(E);
figure;
subplot(1,3,1);
E1 = E(:,img1,img2);
imshow(E1);
E2=E(img1,:,img3);
sublot(1,3,2);
imshow(E2);
E3=E(img1,img2,:);
sublot(1,3,3);
imshow(E3);
  1. This results into error

    ??? Subscript indices must either be real positive integers or logicals.

    Error in ==> combined_img at 11
    E1 = E(:,img1,img2);

Please help to resolve this .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:28:33+00:00Added an answer on May 20, 2026 at 5:28 pm

    The error is exactly what it says it is: the indices must be integers or logicals. When you try to index using img1, it’s likely that it contains non-integers, which throws the error. Here’s what you should do:

    E=[img1; img2; img3];%#combine the images
    E1=E(1:512,:,:);
    E2=E(513:1024,:,:);
    E3=E(1025:end,:,:);
    

    You can also do it more elegantly as

    imgDim=size(img1,1);%# since they're all equal dimensions, we'll need just one.
    imgCell=mat2cell(E,[imgDim,imgDim,imgDim],imgDim,3);%# create a cell
    [E1, E2, E3]=deal(imgCell{:});%#distribute contents of cell
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Objective: take a UIImage, crop out a square in the middle, change size of
I'm learning objective-c and keep bumping into the @ symbol. It is used in
I have a scenario where I combine two tables into one (using UNION) and
Objective-C has no namespaces; it's much like C, everything is within one global namespace.
Objective : Make a progress bar where users can check how much of a
The Objective Caml language will only produce stack traces if you ask for them
My objective here is really simple -- I'm trying to set an NSString to
My objective is to get the answer from up to 6000 Urls in the
My objective is to write a program which will call another executable on a
In Objective-C, what's the difference between declaring a variable id versus declaring it NSObject

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.