필터 지우기
필터 지우기

MATLAB with JAVA

조회 수: 5 (최근 30일)
Susan
Susan 2011년 6월 30일
Hello everybody,
I am aware that there is a way you can use Java classes in MATLAB, would anyone know how to actually do so and how to draw a simple signal in java class and make it work with MATLAB files??.. I basically want if this idea is possible to write few java classes in JAVA and others in MATLAB for the same project, IS it possible and will be able to integrate it together to behave like one big program. I am asked to use JAVA too even though signals are better used with MATLAB so thought I should use both to have some evidence of Object Oriented Technique

채택된 답변

Chirag Gupta
Chirag Gupta 2011년 6월 30일
I am not sure what you mean by a simple signal in Java. But here is a simple example:
--> Java Code
import java.lang.*;
public class SimpleJavaSignal
{
public int returnSignal()
{
return 56;
}
}
You compile this into SimpleJavaSignal.class.
Use
javaaddpath('directory where the .class file resides')
a = SimpleJavaSignal(); % Creates an object of the java class
methodsview(a); % displays all the methods
a.returnSignal() % calls the Java method returnSignal

추가 답변 (2개)

David Young
David Young 2011년 6월 30일
Yes, it's very straightforward: info here.

Mech Princess
Mech Princess 2011년 12월 12일
I tried this and I get the following error in matlab. Any idea why? thanks. ??? Undefined function or variable 'SimpleJavaSignal'.
  댓글 수: 1
Chirag Gupta
Chirag Gupta 2011년 12월 14일
Did you compile the java program into the .class file and add the correct directory to the javaddpath?
You can check directories on the path using: javaclasspath

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Java from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by