Solved

Calling Matlab From C

Posted on 2004-10-14
6
250 Views
Last Modified: 2010-04-15
Hello All,
   I have a prog in C which outputs few arrays... I have worked the C-prog on Visual Studio... The arrays are then loaded into matlab to plot a graph... I don't want to execute 2 programs.. I want to know how can i call a m- file from C. Since studio doesn't support graphics.h, how can i plot???
TIA
-SUma
0
Comment
Question by:hssuma
6 Comments
 
LVL 11

Accepted Solution

by:
cjjclifford earned 30 total points
Comment Utility
its been a while since I've looked at this, but it is possible to generate C code from your M-Code (I've definitely done this), and also vice versa.

using the program "mcc" you can convert .m files to .c files, and then compile these. I'm not sure if this can be done with the graphing engine, I used it before to prototype mathematical models in Matlab, and then compile C code and wrap the resulting library code to a native application... MCC can be used to generate complete application, or just library code, have a look at the documentation...

Also, I think there's been some work with SWIG (interface wrapping software, www.swig.org)...

sorry, as I said, its been a while (3+years!)...
0
 
LVL 45

Expert Comment

by:Kdo
Comment Utility

Not sure exactly what you're looking for here, but....

Once you write your arrays to files (and close the files) you could use the system() function to run Matlab.


Kent
0
 

Author Comment

by:hssuma
Comment Utility
Can u plzz elaborate on the system() function...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now