I am new with Orekit. I have followed the instructions in the tutorial ‘Integration in other languages’.
I am using Matlab r2019a and Orekit 10.3. When I run the program, I get errors like:
"Arguments to IMPORT must either end with "." or else specify a fully qualified class name: “org.orekit.frames.Frame” fails this test.".*
I have changed the lines as it is said in the tutorial, but it still doesn’t work.
I appreciate your assistance with this.
I am also struggled with using Orekit through Matlab but have overcome most of the issues. I have attached a file for a basic numerical propagation run. Please let me know if you have any questions.orekitNumPropTest.m (10.6 KB)
You will need to change the values for Hipparchus and Orekit depending on what version you are using.
Thank you so much for answering.
After running your file I have realized that my problem lies in how I add the file path. I am not used to integrate other languages in Matlab. Can you help me with that? When adding the java path, where do the Hipparchus folder and the Orekit java file have to be?
The particular Matlab script is run from my Orekit directory (e.g., C:\Orekit). The orekit-10.1.jar will be in that directory. The Hipparchus files (I separate them by release version) are in a sub directory (C:\Orekit\hipparchus_1_7). I am certain there are other more efficient ways to specify these paths but this works for me. Perhaps another user could provide that.
It seems something is not working for me. I am attaching some screenshots.
Don’t know if this all of it but on the lines:
DM = org.orekit.data.DataProvidersManager.getInstance();
crawler = org.orekit.data.DirectoryCrawler(File([cd ,’\OrekitData’]));
You need to change the ‘\OrekitData’ to match your directory ‘\orekit-data’
See if that helps
Thank you, I miss that. I’m trying with other functions like Vectors3D, and the same error appears. It seems like it’s not importing libraries because every function is undefined, I don’t know. Is there any way I can check that?
I will have to do some further digging and get back to you
Thank you very much
If I can make it work, I’ll update the message
Hi David and Stephen,
David, I have just a quick question. Is your Java version at least equal to 8?
Indeed, if your Java version is below 8, you can’t run Orekit.
Please find below a link explaining how to verify your Java version in Matlab and how to configure a new Java version.
You can also try to read this topic on the forum: First step with matlab - #4 by Tintin
Issue solved. Script by @bcazabonne works perfectly.
Thank you very much for your time and help.
I’ve run into some issues running @StephenC 's .m file with the new version(s) of Orekit (v11.1) and Matlab (R2021b). I updated the Matlab Java version to 8 and mapped all of the directories and files properly, but still was getting error messages. Eventually, I figured out from the javadoc that there have been some changes since upgrading from 10.1 to 11.1 that throw errors for some of the method calls. The attached .m file seems to be sufficient to get orekit up and running in Matlab for Orekit v11.1 with Hipparchus v2.0.
orekitStartup.m (2.3 KB)
Note that the KeplerianPropagator no longer has a setSlaveMode method. I “fixed” this by simply removing the statement. Not sure what the effects might be.
I still get an error in @StephenC 's file when trying to run “periodMin = periodKm(sma_m/1000.0);” but I don’t think that is an Orekit issue… Still working my way through this example to get it all running.
A question for Matlab users: Has anyone figured out how to get autocompletion for the java methods/classes/etc to work? It’s a pain to constantly refer back to the javadoc.
Did you find any issues with the approach you listed here? Did the removed statement have any issues?
The function “periodKm” maybe be writen by Stephen, not a class in Orekit, because I can’t find it in Eclipse.
I think I have made it successfully to connect between matlab and Orekit, and run basic code faultlessly.
However, when the code "earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2003,true);
" was run in matlab, there are some exception occurred.
org.orekit.errors.OrekitException: unable to find
Actually, I find that the file is in the path of “resource\assets\org\orkit\IERS-conventions\2003.”
So, what should I do to solve thie question?
Maybe you configured the wrong path to access these data?
The configuration of this path is done at the beginning of the code when initializing the data context.
Could you check it?
It can’t be a path problem, the file not found must be part of the resources that are in the Orekit jar.
This problem has been solved. Previous Orekit jar was exported through Eclipse by myself, maybe something went wrong. Well, I load the file of “orekit-11.2.1.jar” and add it to matlab classpath. Then all code run successfully.
Thanks a lot.
Hi, Orekit developers
How to write the matlab code according to Java language of:
final Collection(DSSTForceModel> forces = new ArrayList(DSSTForceModel>();
It’s different in matlab, right?