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

  • Home
  • SEARCH
  • 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

I have a scenario where I combine two tables into one (using UNION) and
What is the easiest and best way in Objective-C to combine a list (NSArray)
Objective: take a UIImage, crop out a square in the middle, change size of
Objective: I want to create a web service that allows me to connect to
Objective-C uses a sophisticated message-passing system when one object calls a method on another
Objective: In support of a Windows Service that may have multiple instances on a
Objective: My script will download a remote file upon form submission, since the file
Objective Change these filenames: F00001-0708-RG-biasliuyda F00001-0708-CS-akgdlaul F00001-0708-VF-hioulgigl to these filenames: F0001-0708-RG-biasliuyda F0001-0708-CS-akgdlaul F0001-0708-VF-hioulgigl Shell
Objective C is new for me. How can I change the font of a
Objective Initialize a new addition problem for users to solve when they visit /task

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.