Matlab Example Programrubackup

  



Package Apps From the MATLAB Toolstrip

Introduction to MATLAB for Engineering Students' is a document for an introductory course in MATLAB°R 1 and technical computing. It is used for freshmen classes at North-western University. This document is not a comprehensive introduction or a reference man-ual. Instead, it focuses on the speciflc features of MATLAB that are useful for. Pcode(item) obfuscates the code in a.m file or folder on the search path and produces P-files with the extension.p.If item is a.m file, then the resulting file is item.p. Several mathematical operations that work on arrays or matrices are built-in to the MATLAB environment. For example, cross-products, dot-products, determinants, inverse matrices. Another important feature is vectorized operations which means you can add two arrays together using only one command, instead of using a for or while loop. Example: A custom-made Matlab function Even though Matlab has plenty of useful functions, in this example we develop a custom-made Matlab function. We have one input value and two output values to transform a given number in both Celsius and Farenheit degrees.

You can package any MATLAB® app you create into a single file that can be easily shared with others. When you package an app, MATLAB creates a single app installation file (.mlappinstall). The installation file enables you and others to install your app and access it from the apps gallery without concern for installation details or the MATLAB path.

Note

As you enter information in the Package Apps dialog box, MATLAB creates and saves a .prj file continuously. A .prj file contains information about your app, such as included files and a description. Therefore, if you exit the dialog box before clicking the button, the .prj file remains, even though a .mlappinstall file is not created. The .prj file enables you to quit and resume the app creation process where you left off.

To create an app installation file:

  1. On the desktop Toolstrip, on the Home tab, click the down-arrow.

  2. Click .

  3. In the Package App dialog box, click Add main file and specify the file that you use to run the app you created.

    The main file must be callable with no input and must be a function or method, not a script. MATLAB analyzes the main file to determine if there are other files used in the app. For more information, see App Packaging Dependency Analysis.

    Tip

    The main file must return the figure handle of your app for MATLAB to remove your app files from the search path when users exit the app. For more information, see What Is the MATLAB Search Path?

    (Functions created by GUIDE return the figure handle.)

  4. If your app requires additional files that are not listed under Files included through analysis, add them by clicking Add files/folders.

    You can include external interfaces, such as MEX-files or Java® in the .mlappinstall file, although doing so can restrict the systems on which your app can run.

  5. Describe your app.

    1. In the App Name field, type an app name.

      If you install the app, MATLAB uses the name for the .mlappinstall file and to label your app in the apps gallery.

    2. Optionally, specify an app icon.

      Click the icon to the left of the App Name field to select an icon for your app or to specify a custom icon. MATLAB automatically scales the icon for use in the Install dialog box, App gallery, and quick access toolbar.

    3. Optionally, select a previously saved screenshot to represent your app.

    4. Optionally, specify author information.

    5. In the Description field, describe your app so others can decide if they want to install it.

    6. Identify the products on which your app depends.

      Click the plus button on the right side of the Products field, select the products on which your app depends, and then click Apply Changes. Keep in mind that your users must have all of the dependent products installed on their systems.

    After you create the package, when you select a .mlappinstall file in the Current Folder browser, MATLAB displays the information you provided (except your email address and company name) in the Current Folder browser Details panel. If you share your app in the MATLAB Central File Exchange, the same information also displays there. The screenshot you select, if any, represents your app in File Exchange.

  6. Click .

    As part of the app packaging process, MATLAB creates a .prj file that contains information about your app, such as included files and a description. The .prj file enables you to update the files in your app without requiring you to respecify descriptive information about the app.

  7. In the Build dialog box, note the location of the installation file (.mlappinstall), and then click .

For information on installing the app, see Install Add-Ons from File.

Related Topics

Convert a function file into a P-file.

In a file named myfunc.m in your current folder, define a function that returns the square root of a cubic polynomial.

Matlab Example Programrubackup

Create a P-file from myfunc.m. Determine which file MATLAB® uses when you call myfunc.

Convert selected files from the sparfun folder into P-files.

Create a temporary folder and define an existing path to .m files.

Create the P-files.

The temporary folder now contains encoded P-files.

Generate P-files from input files that are part of a class. (The same procedure can be applied to files that are part of a package.) This example uses an existing MATLAB example class.

Define classfolder as an existing class folder that contains .m files.

Matlab Example Programrubackup Worksheet

Create a temporary folder. This folder has no class structure at this time.

Create a P-file for every .m file in the path classfolder. Because the input files are part of a class, MATLAB creates a folder structure so that the output file belongs to the same class.

The P-file resides in the same folder structure.

Generate P-files in the same folder as the input files.

Copy several .m files to a temporary folder.

Matlab example programrubackup method

Matlab Example Programrubackup Function

Create P-files in the same folder as the original .m files.