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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:44:55+00:00 2026-06-09T06:44:55+00:00

Scenario I’m working with a Java model built from scratch in Eclipse. What’s important

  • 0

Scenario

I’m working with a Java model built from scratch in Eclipse. What’s important in this model is that we save our output to MATLAB (.mat) files. I constantly add new features, which require new fields that in turn will have to be exported to the .mat file at every iteration. Upon restarting a crashed simulation, I might have to import the .mat file. To export or import my .mat file I use JMatIO.

For example, if I would add a new field rho_m (a simple double) to my class CModel, I have to add to my Save() method:

mlModel.setField("rho_m", new MLDouble(null, new double[] {rho_m}, 1));

And to my Load() method:

rho_m = ((MLDouble)mlModel.getField("rho_m")).getReal(0);

Note that even though rho_m is a double, it needs to be treated as a double[] in JMatIO. This probably has something to do with MATLAB being orientated towards matrices and matrix operations.

Problem

Instead of doing this manually (prone to errors, annoying to maintain) I would like to automate this procedure. Ideally, I would like my IDE to detect all the fields in CModel and write the code based on the field’s name and type. Is there any way to do this in Java/Eclipse?

Ideas so far

I have no formal training in low-level programming languages (yes, Java is low-level to me) and am still relatively new to Java. I do have some experience with MATLAB. In MATLAB I think I could use eval() and fieldnames() in a for loop to do what I mentioned. My last resort is to copy-paste the Java code to MATLAB and from there generate the code using a huge, ugly script. Every time I want to make changes to the model I’d rerun the MATLAB script.

Besides that idea I’ve found terms like UML, but do not have the background knowledge to figure out if this is what I’m looking for or not.

Any help, even if it’s just a small push in the right direction, is greatly appreciated. Let me know if I need to further clarify anything.

  • 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-09T06:44:57+00:00Added an answer on June 9, 2026 at 6:44 am

    Looking at your scenario, you are doing model-driven code generation, that is, you have a model and want to get some code generated according to your current model. Therefore, you need a model-driven code generator.

    I lead the ABSE/AtomWeaver project, so I’ll outline what you can do to get what you want using AtomWeaver (There are however other solutions like MetaEdit+, XText or Eclipse’s own GMT/EMF sub-system).

    AtomWeaver is an IDE where you can build a model and generate code from that model. You can change your model as many times you want and hit the “Generate” button to get an updated version of your code. ABSE is the name of the modeling method.

    We don’t need to go into details, but essentially ABSE follows a “building-block” approach. You create a Template that represents a feature or concept of your model. Then, you can associate a mini-code generator just to that concept. You can then “instantiate” and combine those building blocks to quickly build your models. Variables increase the flexibility of your models.

    You can also change your models, or add new features (“blocks”) and generate again. The generators are built using the Lua programming language, a very simple language with C-Like syntax.

    The best way to understand the ABSE development method and the AtomWeaver IDE is to download the IDE and see the samples or try the tutorials. And yes, you can use AtomWeaver for free.

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

Sidebar

Related Questions

Scenario: At our company, we have enabled httpCompression for our website. This website (call
Scenario 1 (That Works) This is a POC i created. I have a script
Scenario: I'm working on a solution that has many assemblies. The main assembly references
Scenario: I have a webpage that needs to make XMLRPC calls from Javascript, and
Scenario: Making an Android app using data from a website built with Wordpress. The
Scenario: A save function first reads the total number of rows from a table
Scenario : I'll try to put an analogy with the loan broker example from
Scenario While using the Maven Ant Task artifact:deploy , I'm encountering the error java.lang.OutOfMemoryError:
Scenario: Most smartphones have a high resolution camera that generates photos that may range
Scenario: I am calling a function that returns a field that the user enters

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.