?? plotternative.cs
字號:
/*
* MATLAB Compiler: 4.10 (R2009a)
* Date: Wed May 13 09:41:13 2009
* Arguments: "-B" "macro_default" "-W" "dotnet:PlotComp,Plotter,0.0,private" "-d"
* "D:\FDTD_Matlab\學習資料\Matlab_Csharp\PlotComp\src" "-T" "link:lib" "-v"
* "class{Plotter:D:\FDTD_Matlab\學習資料\Matlab_Csharp\drawgraph.m}"
*/
using System;
using System.Reflection;
using System.IO;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.ComponentData;
#if SHARED
[assembly: System.Reflection.AssemblyKeyFile(@"")]
#endif
namespace PlotCompNative
{
/// <summary>
/// The Plotter class provides a CLS compliant, Object (native) interface to the
/// M-functions contained in the files:
/// <newpara></newpara>
/// D:\FDTD_Matlab\學習資料\Matlab_Csharp\drawgraph.m
/// <newpara></newpara>
/// deployprint.m
/// <newpara></newpara>
/// printdlg.m
/// </summary>
/// <remarks>
/// @Version 0.0
/// </remarks>
public class Plotter : IDisposable
{
#region Constructors
/// <summary internal= "true">
/// The static constructor instantiates and initializes the MATLAB Component
/// Runtime instance.
/// </summary>
static Plotter()
{
if (MWMCR.MCRAppInitialized)
{
Assembly assembly= Assembly.GetExecutingAssembly();
string ctfFilePath= assembly.Location;
int lastDelimiter= ctfFilePath.LastIndexOf(@"\");
ctfFilePath= ctfFilePath.Remove(lastDelimiter, (ctfFilePath.Length - lastDelimiter));
string ctfFileName = MCRComponentState.MCC_PlotComp_name_data + ".ctf";
Stream embeddedCtfStream = null;
String[] resourceStrings = assembly.GetManifestResourceNames();
foreach (String name in resourceStrings)
{
if (name.Contains(ctfFileName))
{
embeddedCtfStream = assembly.GetManifestResourceStream(name);
break;
}
}
mcr= new MWMCR(MCRComponentState.MCC_PlotComp_name_data,
MCRComponentState.MCC_PlotComp_root_data,
MCRComponentState.MCC_PlotComp_public_data,
MCRComponentState.MCC_PlotComp_session_data,
MCRComponentState.MCC_PlotComp_matlabpath_data,
MCRComponentState.MCC_PlotComp_classpath_data,
MCRComponentState.MCC_PlotComp_libpath_data,
MCRComponentState.MCC_PlotComp_mcr_application_options,
MCRComponentState.MCC_PlotComp_mcr_runtime_options,
MCRComponentState.MCC_PlotComp_mcr_pref_dir,
MCRComponentState.MCC_PlotComp_set_warning_state,
ctfFilePath, embeddedCtfStream, true);
}
else
{
throw new ApplicationException("MWArray assembly could not be initialized");
}
}
/// <summary>
/// Constructs a new instance of the Plotter class.
/// </summary>
public Plotter()
{
}
#endregion Constructors
#region Finalize
/// <summary internal= "true">
/// Class destructor called by the CLR garbage collector.
/// </summary>
~Plotter()
{
Dispose(false);
}
/// <summary>
/// Frees the native resources associated with this object
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary internal= "true">
/// Internal dispose function
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
disposed= true;
if (disposing)
{
// Free managed resources;
}
// Free native resources
}
}
#endregion Finalize
#region Methods
/// <summary>
/// Provides a void output, 0-input Object interface to the drawgraph M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// DRAWGRAPH Plot a curve from the specified x and y coordinates contained in the
/// coords array.
/// DRAWGRAPH (coords) Plots a curve from the specified coordinate values
/// in a MATLAB figure window.
/// This file is used as an example for the MATLAB Builder NE product.
/// </remarks>
///
public void drawgraph()
{
mcr.EvaluateFunction(0, "drawgraph", new Object[]{});
}
/// <summary>
/// Provides a void output, 1-input Object interface to the drawgraph M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// DRAWGRAPH Plot a curve from the specified x and y coordinates contained in the
/// coords array.
/// DRAWGRAPH (coords) Plots a curve from the specified coordinate values
/// in a MATLAB figure window.
/// This file is used as an example for the MATLAB Builder NE product.
/// </remarks>
/// <param name="coords">Input argument #1</param>
///
public void drawgraph(Object coords)
{
mcr.EvaluateFunction(0, "drawgraph", coords);
}
/// <summary>
/// Provides the standard 0-input Object interface to the drawgraph M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// DRAWGRAPH Plot a curve from the specified x and y coordinates contained in the
/// coords array.
/// DRAWGRAPH (coords) Plots a curve from the specified coordinate values
/// in a MATLAB figure window.
/// This file is used as an example for the MATLAB Builder NE product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return.</param>
/// <returns>An Array of length "numArgsOut" containing the output
/// arguments.</returns>
///
public Object[] drawgraph(int numArgsOut)
{
return mcr.EvaluateFunction(numArgsOut, "drawgraph", new Object[]{});
}
/// <summary>
/// Provides the standard 1-input Object interface to the drawgraph M-function.
/// </summary>
/// <remarks>
/// M-Documentation:
/// DRAWGRAPH Plot a curve from the specified x and y coordinates contained in the
/// coords array.
/// DRAWGRAPH (coords) Plots a curve from the specified coordinate values
/// in a MATLAB figure window.
/// This file is used as an example for the MATLAB Builder NE product.
/// </remarks>
/// <param name="numArgsOut">The number of output arguments to return.</param>
/// <param name="coords">Input argument #1</param>
/// <returns>An Array of length "numArgsOut" containing the output
/// arguments.</returns>
///
public Object[] drawgraph(int numArgsOut, Object coords)
{
return mcr.EvaluateFunction(numArgsOut, "drawgraph", coords);
}
/// <summary>
/// This method will cause a MATLAB figure window to behave as a modal dialog box.
/// The method will not return until all the figure windows associated with this
/// component have been closed.
/// </summary>
/// <remarks>
/// An application should only call this method when required to keep the
/// MATLAB figure window from disappearing. Other techniques, such as calling
/// Console.ReadLine() from the application should be considered where
/// possible.</remarks>
///
public void WaitForFiguresToDie()
{
mcr.WaitForFiguresToDie();
}
#endregion Methods
#region Class Members
private static MWMCR mcr= null;
private bool disposed= false;
#endregion Class Members
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -