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.
% 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]); plot(s); grid xlabel('Time'); title('Testing DLL Program for Plotting a Response'); ylabel('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 ...