Can anyone tell me how I can use Matlab Plotting Tools from my C# application? I am new to Matlab, so I don't know anything about the Matlab Plotting Tools. The requirement is that I have to use Matlab plotting tools to plot my data from C# application. Like embed the Matlab tools in my C# Windows Form Application Interface. Thank you for your time...
2 Answers
Using the additional product MATLAB Builder for .NET, you can deploy your MATLAB code to a .NET assembly and call it from C#. The first link from @Marshal describes that process well.
However, it's not possible to parent a MATLAB axis to a Windows Form directly. You can either have your C# application pop up the plot in a separate MATLAB figure window, or you can save the plot off temporarily to a static image file and display that in the Windows Form.
In addition, if by "the MATLAB plotting tools", you mean not only plots themselves but the interactive tools that allow runtime manipulation of plots - these are explicitly excluded from deployment using the Builder products. See the documentation for details.

- 23,951
- 1
- 40
- 64
-
Excuse me, how can I pop up the plot in separate MATLAB figure window from C# application? That's exactly what I want to do... I have data, I want to use different types of plots to see my data. I've used Windows Chart Control, ZedGraph. Thank you so much for replying my questions. :) – Jin Ling Apr 12 '12 at 09:08
-
1In general terms, you would write a function in MATLAB that accepts your data as input, and creates whatever plot of it you would like. This would appear in a MATLAB figure window. Then using MATLAB Builder for .NET you would convert this function into a .NET assembly. The first link from @Marshal contains a good introduction to that process, but it's fairly simple. The from your C# code, call the deployed assembly, pass it whatever data you want to plot, and it will appear in a separate MATLAB figure window. – Sam Roberts Apr 12 '12 at 16:46
Please go through these links, you will find your answers in it.
Interoperating between Matlab and C#
http://www.mathworks.com/matlabcentral/fileexchange/12987-integrating-matlab-with-c
http://www.codeproject.com/Articles/5468/1-2-3-ways-of-integrating-MATLAB-with-the-NET