0

I have lot of .c file which is autogenerated by simulink coder. Analyzing those file to understand simulink model is some what time consuming, As per my knowledge there is no reverse tool which converts c code to simulink model.

so is there any possiblity to convert the auto generated c file to simulink model using any parser?

4 Answers 4

2

Short answer: No.

The real question is: why would you want to do that? The golden reference (the design if you want) is the model from which the code is generated, it's a one-way system. If you want to change the design, change the model, re-generate the code. That's how it's designed and intended to work, not the other way round.

You can however integrate C code (functions) into a Simulink model the legacy code tool, but that's a different exercise to what you are asking. You can also call external C code from a Simulink model using a MATLAB Function block and the coder.ceval command, see Integrate C Code Using the MATLAB Function Block in the documentation for more detail.s.

Sign up to request clarification or add additional context in comments.

2 Comments

BTW if I am having original model I would have not posted this question . Due to some reason I am unable to get original model but i have the c files of that and i need to refer it.
You didn't say in your question... I'm afraid the only option I know of is to request the original model from which the code is generated.
2

There is some research like this one in that area, but any approach I know attempts to convert general c code to a model. The "best" performance I have ever heard of was a ready to use and no longer available prototype which generated incredible huge simulink models out of some lines of c code.

To have any practical use in your use case, a translator which recognizes the original model blocks would be required. Such a software does not exist.

1 Comment

Found similar research topic
1

You can try Modelify.

Modelify is a new tool that converts legacy C code into Simulink models. Instead of a verbatim conversion, Modelify transforms low-level logic from C into higher level constructs in Simulink.

Website Link

Comments

0

Converting C code to Simulink model is counter-intuitive as mentioned by @am304. If you were to integrate C code with Simulink model, you can use what Simulink offers through 'C Function block'.

Find more details about this workflow at: Integrate C code with Simulink using C Function block

1 Comment

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.