Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Builder NE   

Quick Start: Implementing a WebFigure

Overview

Using Quick Start, both the WebFigure service and the page that has the WebFigure embedded on it reside on a single server. This configuration enables you to quickly drag and drop the WebFigureControl on a Web page.

Procedure

To implement WebFigures for MATLAB Builder NE using the Quick Start approach, do the following. For more information about the Quick Start option, see About the WebFigures Feature.

  1. Start Microsoft Visual Studio.

  2. Select File > New > Web Site to open.

  3. Select one of the template options and click OK.

      Caution   Do not select Empty Web Site as it is not possible create a WebFigure using this option.

  4. Add WebFigureControl to the Microsoft Visual Studio toolbar by dragging the file InstallRoot\toolbox\dotnetbuilder\bin\arch\v2.0\
    WebFiguresService.dll
    , (where InstallRoot is the location of the installed MCR for machines with an installed MCR and matlabroot on a MATLAB Builder NE development machine without the MCR installed), on to the Microsoft Visual Studio Toolbox toolbar as follows:

      Note   If you are running on a system with 64-bit architecture, use the information in Advanced Configuration of a WebFigure to work with WebFigures unless you are deploying a Web site which is 32-bit only and you have a 32-bit MCR installed.

    1. Expand the General section of the Toolbox toolbar.

    2. Using your mouse, drag the DLL file to the expanded section, as shown by the arrow:

    If you added the control correctly, you will see the following WebFigureControl in the General section of the Microsoft Visual Studio toolbar:

  5. Drag the WebFigureControl from the toolbar to your Web page. After dragging, the Web page displays the following default figure.

    You can resize the control as you would any other .NET Web control.

  6. Switch to the Design view in Microsoft Visual Studio by selecting View > Designer.

  7. Test the Web page by "playing" it in Microsoft Visual Studio. Select Debug > Start Debugging. The page should appear as follows.

  8. Interact with the default figure on the page using your mouse. Click one of the three control icons at the top of the figure to activate the desired control, select the desired region of the figure you want to manipulate, then click and drag as appropriate. For example, to zoom in on the figure, click the magnifying glass icon, then hover over the figure.

  9. Close the page as you would any other window, automatically exiting debug or "play" mode.

  10. The WebFigureService you created has been verified as functioning properly and you can attach a custom WebFigure to the Web page:

    1. To enable return of the webfigure and to bind it to the webfigure control, add a reference to MWArray to your project and a reference to the deployed component you created earlier (in Assumptions About the Examples). See Using Components Created by the MATLAB Builder NE Product for more information.

    2. In Microsoft Visual Studio, access the code for the Web page by selecting View > Code.

    3. In Microsoft Visual Studio, go to the Page_Load method, and add this code, depending on if you are using the C# or Visual Basic language. Adding code to the Page_Load method ensures it executes every time the Web page loads.

      • C#:

        using MyComponent;
        using MathWorks.MATLAB.NET.WebFigures;
        
        public class
        {
                protected void Page_Load(object sender, EventArgs e)
                {
                        MyComponentclass myDeployedComponent =
                                new MyComponentclass();
                        WebFigureControl1.WebFigure =
                                new WebFigure(myDeployedComponent.getKnot());
                }
        }
      • Visual Basic:

        Imports MyComponent
        Imports MathWorks.MATLAB.NET.WebFigures
        
        Class
                Protected Sub Page_Load(ByVal sender As Object,
                                        ByVal e As System.EventArgs)
                                        Handles Me.Load
                        Dim myDeployedComponent As _
                                New MyComponentclass()
                        WebFigureControl1.WebFigure = _
                                New WebFigure(myDeployedComponent.getKnot())
                End Sub
        End Class

        Note   WebFigureControl stores the WebFigure object in the IIS session cache for each individual user. If this is not the desired configuration, see Advanced Configuration of a WebFigure for information on creating a custom configuration.

  11. Replay the Web page in Microsoft Visual Studio to confirm your WebFigure appears as desired. It should look like this.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS