Embeding C Code to Matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I have a C code that returns 1024byte hexadecimal value. This value is actually data extracted from a digital oscilloscope. Since I can extract data command by command, it should be possible to plot this data in Matlab continuously - like a data acquisition system. The following is a sample capture gathered from compiled C binary output;
23 38 30 30 30 30 30 36 30 30 CE 35 36 35 36 34 35 36 36 35 35 35 36 34 35 36 35 36 35 36 36 35 35 36 36 35 35 36 35 36 35 35 35 36 34 36 35 36 35 36 36 34 35 35 35 36 35 36 35 34 35 CE CD CE CE CE CE CD CE CE CE CD CE CE CE CD CE CD CD CE CE CE CE CE CE CE CE CE CE CE CE CE CD CE CE CD CF CD CE CE CE CD CE CE CD CE CE CE CE CE CE 36 36 35 34 36 36 34 35 35 35 36 35 36 35 36 35 36 36 35 35 36 35 34 35 35 35 35 36 35 35 35 36 35 36 34 35 34 35 36 35 35 35 36 35 36 35 36 35 36 34 CD CE CE CE CD CE CE CD CF CE CD CE CD CD CE CE CD CD CE CE CD CE CE CE CD CE CD CE CF CE CE CE CD CE CD CD CF CE CE CE CE CE CE CE CF CE CD CE CE CE 35 35 36 36 34 35 34 34 36 35 34 35 36 35 35 36 34 36 33 35 35 35 34 35 34 35 36 35 34 35 35 35 36 34 36 35 34 36 35 36 34 35 35 34 36 34 36 35 34 35 CD CE CD CD CE CE CD CE CE CD CE CE CE CE CD CE CE CE CD CE CD CE CD CE CD CE CD CE CD CE CD CE CD CE CE CE CD CE CD CD CE CE CD CE CE CD CE CE CD CE 35 36 34 35 34 35 34 35 34 35 35 35 34 35 34 36 35 36 34 35 34 35 35 35 34 34 35 35 35 35 36 36 34 35 35 36 34 35 35 34 35 34 36 34 35 35 35 35 34 35 CD CD CF CE CD CE CC CE CD CE CD CE CD CE CD CE CD CE CD CE CD CE CD CE CD CE CD CD CF CE CE CE CD CE CD CE CD CE CD CE CD CE CE CE CD CE CD CE CD CE 36 35 35 34 35 35 36 35 35 35 36 35 34 35 34 35 34 35 34 35 33 36 34 36 34 34 35 35 34 35 34 36 34 35 35 35 36 35 34 35 34 35 36 34 36 35 34 36 35 34 CD CD CE CE CE CE CD CE CD CE CE CE CD CE CD CE CC CE CD CE CD CE CC CE CD CE CD CD CE CE CD CE CE CE CE CE CE CE CC CE CE CE CD CE CD CE CD CE CD CE 35 35 34 35 34 36 34 33 36 35 35 35 35 34 36 35 35 34 36 35 34 35 34 35 35 35 36 35 36 34 35 35 36 34 35 35 34 35 34 35 34 34 36 35 34 36 34 35 36 34 CD CE CD CE CE CD CE CD CE CE CE CE CD CE CD CE CD CE CD CE CE CE CD CE CD CD CE CE CD CE CD CE CE CE CD CE CE CE CD CE CD CE CD CE CD CD CE CE CD
AFAIK I have two options ;
1- Continuously run the compiled C binary and read the output from Matlab interface to plot analyze and etc. 2- Generate necessary MEX file and call the function from Matlab interface
Which one is more efficient ? How can I plot this hexadecimal output continuously realtime? I have been doing some low level programming (C code) just because I couldn't get my device to work with Matlab instrumentation toolbox thus seeking for external approaches.
I would -really- appreciate some guidance from experienced users.
0 Commenti
Risposte (1)
Kaustubha Govind
il 13 Dic 2011
How exactly do you plan to achieve #1? Do you write to a port/file from the C binary that MATLAB should read?
My choice would be #2 because that makes for a more elegant solution (I haven't personally done this kind of thing, but #2 should also be more efficient than #1 in general).
You can then call the MEX-function in a loop. See Updating Plot Object Axis and Color Data for an example of a script that continuously updates a plot.
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Import and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!