3.6. Create a Matlab Function as a DLL

Method IV. Create the Matlab function as a shared DLL, which can be called from the VC++ programming environment.

Step 1. Create an M-function named dataplotdll.m in the Matlab environment as shown in Figure 3-19.

Figure 3-19.
					% Function to plot the real-time data - developed a dll
					% INPUT: s - Data array
					% OUTPUT: None
					% Name: dataplotdll.m
					function dataplotdll()
					fid = fopen('C:\data\dlldata.txt', 'r');
					[s] = fscanf(fid, '%f ', [1, 200]);
					title('Testing DLL Program for Plotting a Response');

In this example, in order to make things simple, a data array with 10 elements is used, which will be generated in the Visual C++ domain and implemented in the Matlab ...

Get Applications Interface Programming Using Multiple Languages: A Windows® Programmer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.