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 8318459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:58:54+00:00 2026-06-08T21:58:54+00:00

I am using Matlab’s GUIDE for the first time, I am trying to edit

  • 0

I am using Matlab’s GUIDE for the first time, I am trying to edit one of the two push button functions (both open an image), but editing one changes all of them. Here is a bit of code:

% --- Executes on button press in Floating.
function Floating_Callback(hObject, eventdata, handles)

clc;
axes(handles.axes1);
[Float, PathName, FilterIndex] = uigetfile('*.bmp');
if(Float ~= 0) 
    Floating = fullfile(PathName, Float);
    FloatArray = imread(Floating);
    imshow(FloatArray);
    axis on; 
end 

% Update handles structure
guidata(hObject, handles);

% hObject    handle to Floating (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in Reference.
function Reference_Callback(hObject, eventdata, handles)

clc;
axes(handles.axes2);
[Ref, PathName, FilterIndex] = uigetfile('*.bmp');
if(Ref ~= 0) 
    Reference = fullfile(PathName, Ref);
    ReferenceArray = imread(Reference);
    image(ReferenceArray); 
end 

% Update handles structure
guidata(hObject, handles);

For example,

image(ReferenceArray) 

will open an image in RBG, but

imshow(FloatArray) 

will open in grayscale (I also do not understand why that is). But my main concern is after opening up

imshow(FloatArray)

the other image will automatically turn grayscale. I am very confused… Also, as far as I know the images ARE already grayscale, at least they are when I open them in MS paint or ImageJ.

  • 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-06-08T21:58:55+00:00Added an answer on June 8, 2026 at 9:58 pm

    It would be better to explicitly specify the parent handle whenever you are doing GUI stuff. For example:

    imshow(img, 'Parent',handles.ax1)
    

    and

    axis(handles.ax1, 'on')
    

    As for images and colormaps, you should understand the type of images MATLAB supports (indexed vs. truecolor). Also note that a figure has only one colormap applied to all images, although there are techniques to overcome this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment to create a GUI using MATLAB GUIDE and am having
We are trying to model a DC/DC buck converter using matlab's ode23 solver. When
I'm trying to connect to MySQL using MATLAB R2009b 64 bit and the mysql.cpp
I'm using MATLAB to access a postgresql database. I'm running into problems trying to
I'm trying to compute a rather ugly integral using MATLAB. What I'm having problem
I am trying to draw 256 small sized squares using MATLAB rectangle function. If
I am using Matlab to do one of my projects. I am stuck at
When using MATLAB's lsqnonlin function, I am trying to give a user-defined Jacobian matrix,
I am using Matlab for one of my projects. I am actually stuck at
I'm using MATLAB Builder NE for interoperability to call MATLAB functions from a C#

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.