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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:46:13+00:00 2026-05-11T11:46:13+00:00

I just discovered that when calling Java from Matlab object.method(arg1,…,argn) is equivalent to method(object,

  • 0

I just discovered that when calling Java from Matlab

object.method(arg1,...,argn) 

is equivalent to

method(object, arg1,...,argn) 

The problem here is I also have a method.m that does some translation from Java to Matlab (eg. convert String[] to cell of strings). My method.m looks like

function result = method(object, arg1,...argn)   intermediate = object.method(arg1,...argn);   result = translate(intermediate); 

What is happening is when I call method(object, arg1,...,argn), it does the direct Java call, instead of my using my method.m

The fix is easy, just don’t use the same method name for both my Java methods and my .m files. But is there another way? How do I know which method will be called given the same name? Is there a way to ensure I call method.m instead of the Java method? Its easy to ensure a call to the Java method, just use the object.method syntax.

As a side note, what is also silly is the .m Editor links to the method.m on the method(object, arg1,...,argn) call, while when it debugs it calls the Java method.

  • 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. 2026-05-11T11:46:13+00:00Added an answer on May 11, 2026 at 11:46 am

    You may be running into some problems with how MATLAB does dispatching…

    How do I know which method will be called given the same name?

    This section of the MATLAB documentation discusses how a function is chosen in cases when there are multiple functions with the same name. From the documentation: ‘The function precedence order determines the precedence of one function over another based on the type of function and its location on the MATLAB path.’ This order (from highest to lowest) is given below:

    • Subfunction
    • Private function
    • Class constructor
    • Overloaded method
    • Function in current directory
    • Function elsewhere on the path

    The placement of your ‘method.m’ function will likely determine if it gets called or the Java method gets called when using the ‘method(object,…)’ syntax.

    Is there a way to ensure I call method.m instead of the Java method?

    Right now, I’m guessing your ‘method.m’ is in the current directory or elsewhere on the path (the two lowest precedence positions to be in). If you made ‘method.m’ a subfunction in the larger code calling it, or if it’s possible to put it in a private directory where it can be called by every function that needs to call it, then it may get called instead of the Java method when you use the ‘method(object,…)’ syntax.

    Hope this helps!

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

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think you want grep: #!/usr/bin/env perl use strict; use… May 12, 2026 at 12:05 am
  • Editorial Team
    Editorial Team added an answer The line echo "$array"; will just output 'array' or similar.… May 12, 2026 at 12:05 am
  • Editorial Team
    Editorial Team added an answer Here's how it works: There's a class called NSXMLParser. It's… May 12, 2026 at 12:05 am

Related Questions

I just discovered that when calling Java from Matlab object.method(arg1,...,argn) is equivalent to method(object,
I've got a project where I've just discovered that warning C4244 (possible loss of
I've been tasked with implementing a Date/Time selector for several areas of our web
Certain directories are protected by Basic Auth using a .htaccess file on an older
I have this code: $rows = array(); $res = mysql_query($someQuery); if(!mysql_errno()) while($row = mysql_fetch_assoc($res))

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.