I want Matlab program to call a java file, preferably with an example.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Ok, I’ll try to give a mini-example here. Either use the java functions right from the Matlab window as zellus suggests, or, if need permits, create your own java class. Here’s an example:
Then turn it into a jar file. Assuming you put the file in a folder called
testMatlabInterface, run this command at the command line:Then, in Matlab, navigate to the directory where your
testMatlab.jarfile is located and run the command,import testMatlabInterface.*to import all the classes in thetestMatlabInterfacepackage. Then you may use the class like so:Let me know if I can be of further assistance.