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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:13:43+00:00 2026-06-01T19:13:43+00:00

I’m trying to convert an image file into a binary file, where I’m using

  • 0

I’m trying to convert an image file into a binary file, where I’m using 2 buttons in Matlab GUI.
the first button it to browse the files then shows the file name on a static text, and the second button for saving it as a CSV file, and this is my code

function varargout = signatureGUI(varargin)   
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
               'gui_Singleton',  gui_Singleton, ...
               'gui_OpeningFcn', @signatureGUI_OpeningFcn, ...
               'gui_OutputFcn',  @signatureGUI_OutputFcn, ...
               'gui_LayoutFcn',  [] , ...
               'gui_Callback',   []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT



% --- Executes just before signatureGUI is made visible.
function signatureGUI_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;
handles.filename = 0;

guidata(hObject, handles);



% --- Outputs from this function are returned to the command line.
function varargout = signatureGUI_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;



% --- Executes on button press in browsefile.
function browsefile_Callback(hObject, eventdata, handles)

filename = uigetfile({'*.jpg'; '*.jpeg'; '*.png'});

handles.filename=filename;
guidata(hObject, handles);

set(handles.showfile, 'String',filename );



% --- Executes on button press in buttonwritecsv.
function buttonwritecsv_Callback(hObject, eventdata, handles)

handles.filename;

    new = imread (filename);
    newrgb=rgb2gray(new);
    newrgb_io = binz(newrgb);

    [filecsv,pathcsv] = uiputfile('*.csv','Save CSV File');
    csvwrite([filecsv,pathcsv], newrgb_io);

guidata(hObject, handles);

I’m trying to use the ” handles.filename ” to let the Save As button able to get the variable from the Browse button, but when I click on the Save As button after browse for the file, it do nothing…

Am I missing something or making mistake in using it?

After I follow the answer from @Richante I got this following error, which I dont understand

??? Reference to non-existent field 'output'.

Error in ==> signatureGUI>signatureGUI_OutputFcn at 34
varargout{1} = handles.output;

Error in ==> gui_mainfcn at 265
        feval(gui_State.gui_OutputFcn, gui_hFigure, [],
        gui_Handles);

Error in ==> signatureGUI at 17
    gui_mainfcn(gui_State, varargin{:});

I dont know what is it..

  • 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-01T19:13:45+00:00Added an answer on June 1, 2026 at 7:13 pm

    Yes, this isn’t quite right. Don’t use handles to store the data – Use your own struct. In OpeningFcn:

    myData.filename = [];
    guidata(hObject, myData);
    

    Then when you want to retrieve this data (e.g. browsefile_Callback):

    ...
    myData = guidata(hObject);
    myData.filename = uigetfile(...);
    set(handles.showfile, 'String', filename);
    

    and buttonwritecsv_Callback:

    myData = guidata(hObject);
    new = imread(myData.filename);
    ...
    

    Basically, guidata(hObject, myData) lets you store myData and myData = guidata(hObject, myData) lets you retrieve it.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.