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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:32:15+00:00 2026-06-08T11:32:15+00:00

I have a patch which I have included below and I want to add

  • 0

I have a patch which I have included below and I want to add an additional ButtonDownFcn to the patch. When I do the second option the code does not work I get to many output arguments.

Original patch

for i = 1:10
    counter = counter+1;
    hpatch(counter) = patch([x(17) x(18) x(1) x(1)],[y(17) y(18) y(1) y(1)],[0 0 0 0],...
    'Parent',hAx,'ButtonDownFcn', ['winopen(''' file(counter) ''');']));
end

New desired patch

for i = 1:10
    counter = counter+1;
    hpatch(counter) = patch([x(17) x(18) x(1) x(1)],[y(17) y(18) y(1) y(1)],[0 0 0 0],...
    'Parent',hAx,'ButtonDownFcn', ['winopen(''' file(counter) ''');'],...
    'ButtonDownFcn', @saveClickData(counter));
end

Here is the function

saveClickData(counter)

should it be this?:

saveClickData(source,event)
  • 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-08T11:32:16+00:00Added an answer on June 8, 2026 at 11:32 am

    Try:

    patch(X,Y,Z, 'ButtonDownFcn',{@saveClickData, counter})
    

    Then define the callback function as:

    function saveClickData(src,evt,counter)
        winopen( file(counter) );
    
        %# do additional stuff..
    end
    

    Make sure to define this function as a nested function, so that it has access to its parent function workspace including the file variable.

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

Sidebar

Related Questions

I have following code: os.chdir(os.path.dirname(os.path.realpath(__file__)) + /../test) path.append(os.getcwd()) os.chdir(os.path.dirname(os.path.realpath(__file__))) Which should add /../test to
I have a powershell script (below) which seems to work but prints an error
Here's the scenario, I have a main.js file in abc.com which does $.post(index.php) to
I have some code (that is working), but I just want to make sure
I have the following code to send users a verification email, which contains some
This is the code in question. Something of a description/explination is included below object
I have two apps between which I want some data exchanged. As they are
I have a powershell script below which takes a config file and deletes files
I have top.xsl file which includes test.xsl as below: The top.xsl is processed at
In Android, I have a Path object which I happen to know defines a

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.