MEX files aned SerialPort C++ class

조회 수: 11 (최근 30일)
Helene
Helene 2013년 4월 24일
댓글: Tharindu Weerakoon 2015년 1월 28일
Hello,
I am using Visual Studio 2010 Express to work with the serial port. I have a C++ program running and it's sending and reading data from the serial port. I'm using C++ because of the SerialPort class which was quite simple.
My programm is running and writing data in a csv file which is used in MATLAB after to plot data.
I would like to know if it is possible to transform this progam into a MEX file code so it would write data directly in MATLAB instead of a file. I would have one operation less so it would be simpler.
Thanks, Helene
  댓글 수: 1
James Tursa
James Tursa 2013년 4월 24일
Do you know how big the data set is going to be before you start gathering data?

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2013년 4월 24일
You can call C++ functions through the MEX interface. You find a lot of manuals and examples here in this forum, in the examples shipped with Matlab and when you ask your favorite internet search engine.
  댓글 수: 1
Tharindu Weerakoon
Tharindu Weerakoon 2015년 1월 28일
Hello Jan,
I'm using Microsoft VS 2012 and MATLAB R2012a on Windows 7 OS. I have to create a serial port C++ mex file for MATLAB to read and write the data for my sensor model (Hokuyo URG-04LX). Any how I tried to create a mex file but couldnot. Can you please give me some guide and example serial port mex file compatible to my OS.
I hope that C++ console project only will work to make mex file/ or dll. Am I right? Is it possible to make mex file with C++ (C or C#)Windows form application?
Can you give me some solution?
Thanks.

댓글을 달려면 로그인하십시오.


Helene
Helene 2013년 4월 24일
Thanks for the answer but if I was asking it's because it is C++/CLI i'm using maybe it changes something.
I did not found the C++ MEX file example from matlab really helful.
I already found example for serial liaison with MEX file but not in C++.
  댓글 수: 1
Jan
Jan 2013년 4월 24일
Please post comments in the comment section.
The degree of usefulness of the examples depends on what you are looking for. The job of the mex function is to convert the Matlab input to the kind of input you need for the C++ part of the program, and finally convert the output of your function back to Matlab arrays. The methods you need for this can be found in the examples.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call C++ from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by