How to call a program in C from Matlab
Show older comments
I used to call a program in C to change parameters in a camera, since the product came with examples in this language.But for sake of automation it would be more efficient do it all from a main program in Matlab.-The key is how to pass the values to the functions and make that the program in c read the values from the functions in my "m" file.Command System works for me, but if there is another way to dothis...I appreciate a clue
Answers (1)
Kaustubha Govind
on 26 Mar 2012
1 vote
4 Comments
Warren
on 26 Mar 2012
Geoff
on 27 Mar 2012
Wrapping your camera control code with MEX should not be a problem if you are familiar with C. You simply create a C source file with the MEX entry function, #include your camera-control stuff in that file, and translate the supplied MatLab parameters into their C equivalent. There is a lot of MEX example code on the web that gives you the basic MatLab API calls. From there, it's just ordinary C.
Jan
on 27 Mar 2012
@Warren: The Mex-gateway is the best solution. If this interface is "overwhelming" for you, this forum is a good location to post your trials and ask specific questions about the mex<> and mx<> commands.
Kaustubha Govind
on 27 Mar 2012
I agree with Geoff and Jan!
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!