MATLAB BUILDER EX 1 Guide de l'utilisateur

Naviguer en ligne ou télécharger Guide de l'utilisateur pour Logiciel MATLAB BUILDER EX 1. MATLAB BUILDER EX 1 User`s guide Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 182
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs

Résumé du contenu

Page 1 - MATLAB Excel Builder

MATLAB Excel BuilderThe Language of Technical ComputingComputationVisualizationProgrammingUser’s GuideVersion 1

Page 2 - How to Contact The MathWorks:

PrefaceviiiWhat Is MATLAB Excel Builder?MATLAB® Excel Builder provides the capability to incorporate seamlessly and quickly MATLAB models and functio

Page 3 - Contents

5 Function Wizard5-14Copy FunctionUse the Copy Function dialog box to make copies of the current function. The Standard Copy tab creates a specified n

Page 4

Introduction5-15MoveUse the Move Function dialog box to move the currently selected function to a new position in the current worksheet. When you set

Page 5 - Function Wizard

5 Function Wizard5-16

Page 6

6Function ReferenceThis section provides detailed descriptions of the MATLAB Excel Builder functions.

Page 7 - Registration and Versioning

componentinfo6-26componentinfoPurpose Query system registrySyntax Info = componentinfo(ComponentName, MajorRevision, MinorRevision)ArgumentsDescriptio

Page 8

componentinfo6-3With a component name and major revision supplied, the function returns information for revision 1.0 of mycomponent.Example 2.Info = c

Page 9

mxltool6-46mxltoolPurpose Graphical user interface to MATLAB Excel BuilderSyntax mxltoolDescription mxltool displays the graphical user interface (GUI

Page 10 - Preface

AProducing a COM Object from MATLABCapabilities . . . . . . . . . . . . . . . . . . . . A-2Calling Conventi

Page 11 - Suggested Background

A Producing a COM Object from MATLABA-2CapabilitiesMATLAB Excel Builder enables you to pass Microsoft Excel worksheet values to a compiled MATLAB mode

Page 12

CapabilitiesA-3Figure A-1: Creating a Stand-Alone COM Object with the MATLAB CompilerThe process of creating a MATLAB Excel Builder component is comp

Page 13 - Limitations and Restrictions

Suggested BackgroundixSuggested BackgroundUsers of this product need to be familiar with• MATLAB and the MATLAB Compiler• Microsoft Excel• Visual Basi

Page 14

A Producing a COM Object from MATLABA-4Figure A-2: M-Build Steps and Intermediate Files Created mcc -B cexel:myc

Page 15 - Typographical Conventions

CapabilitiesA-5Step 1. Code GenerationThe first step in the build process generates all source code and other supporting files needed to create the co

Page 16

A Producing a COM Object from MATLABA-6Step 4. Linking and Resource BindingThe fourth step produces the finished DLL for the component. This step invo

Page 17 - Overview

Calling ConventionsA-7Calling ConventionsThis section describes the calling conventions for MATLAB Excel Builder components, including mappings from t

Page 18 - 1 Overview

A Producing a COM Object from MATLABA-8Producing a COM ClassProducing a COM class requires the generation of a class definition file in Interface Desc

Page 19 - Versions

Calling ConventionsA-9nargout parameter, the outputs are listed in the order they appear on the left side of the MATLAB function, and are tagged as [i

Page 20

A Producing a COM Object from MATLABA-10MATLAB Compiler OutputThe MATLAB Excel Builder generates a default Visual Basic function wrapper for each clas

Page 21

Calling ConventionsA-11Variant to pass collectively the varargin1,...,vararginn parameters in the form of a Variant array. The main function body cont

Page 22

A Producing a COM Object from MATLABA-12

Page 23 - Add File button or

BData ConversionData Conversion Rules . . . . . . . . . . . . . . . B-2Array Formatting Flags . . . . . .

Page 24 - Build Status

PrefacexRequirements for MATLAB Excel Builder System RequirementsSystem requirements and restrictions on use for Excel Builder are almost identical t

Page 25 - Application Deployment

B Data ConversionB-2Data Conversion Rules This section describes the data conversion rules for MATLAB Excel Builder components. Excel Builder componen

Page 26

Data Conversion RulesB-3VT_UI2unsigned short--Unsigned two-byte integerVT_I4 long vbLong LongSigned four-byte integerVT_UI4unsigned long--Unsigned fou

Page 27 - Graphical User Interface

B Data ConversionB-4VT_DECIMAL DECIMAL+vbDecimal -96-bit (12-byte) unsigned integer, scaled by a variable power of 10VT_BOOL VARIANT_BOOL+vbBoolean Bo

Page 28 - 2 Graphical User Interface

Data Conversion RulesB-5Table B-2: MATLAB to COM VARIANT Conversion RulesMATLAB Data Type VARIANT type for Scalar DataVARIANT type for Array DataComm

Page 29 - Project Menu

B Data ConversionB-6charA 1-by-1 char matrix converts to a VARIANT of type VT_BSTR with string length = 1.A 1-by-L char matrix is assumed to represent

Page 30

Data Conversion RulesB-7doubleA real 1-by-1 double matrix converts to a VARIANT of type VT_R8. A complex 1-by-1 double matrix converts to a VARIANT

Page 31 - Help Menu

B Data ConversionB-8uint8A real 1-by-1 uint8 matrix converts to a VARIANT of type VT_UI1. A complex 1-by-1 uint8 matrix converts to a VARIANT of typ

Page 32

Data Conversion RulesB-9int32A 1-by-1 int32 matrix converts to a VARIANT of type VT_I4. A complex 1-by-1 int32 matrix converts to a VARIANT of type

Page 33 - Component Information

B Data ConversionB-10Table B-3: COM VARIANT to MATLAB Conversion RulesVARIANT Type MATLAB Data Type (scalar or array data)CommentsVT_EMPTYN/A Empty a

Page 34

Data Conversion RulesB-11VT_DATE double1. VARIANT dates are stored as doubles starting at midnight Dec. 31, 1899. MATLAB dates are stored as doubles s

Page 35 - Builder Components

Requirements for MATLAB Excel BuilderxiLimitations and RestrictionsIn general, limitations and restrictions on the use of MATLAB Excel Builder are the

Page 36

B Data ConversionB-12Array Formatting FlagsMATLAB Excel Builder components have flags that control how array data is formatted in both directions. Gen

Page 37

Data Conversion RulesB-13Table B-4 shows the array formatting flags.Table B-4: Array Formatting FlagsFlag DescriptionInputArrayFormatDefines the arra

Page 38

B Data ConversionB-14Data Conversion FlagsMATLAB Excel Builder components contain flags to control the conversion of certain VARIANT types to MATLAB t

Page 39 - at the beginning to

Data Conversion RulesB-15bias (693960) as well as coerced to COM dates. Set this flag to True to convert all output values of type Double.DateBias As

Page 41

CRegistration and VersioningThis section describes the registration and versioning of MATLAB Excel Builder components and how to retrieve information

Page 42

C Registration and VersioningC-2Component RegistrationWhen the MATLAB Excel Builder creates a component, it automatically generates a binary file call

Page 43

Component RegistrationC-3Table C-1: KeysKey DefinitionHKEY_CLASSES_ROOT\CLSIDInformation about COM classes on the system. Each component creates a ne

Page 44

C Registration and VersioningC-4VersioningMATLAB Excel Builder components support a simple versioning mechanism designed to make building and deployin

Page 45

Obtaining Registry InformationC-5Obtaining Registry InformationMATLAB Excel Builder includes the MATLAB function componentinfo to query the system reg

Page 46

PrefacexiiRelated Products The MathWorks provides several products relevant to the tasks you can perform with MATLAB Excel Builder.For more informati

Page 47 - ErrObject object

C Registration and VersioningC-6Info.CoClassesans = Name: 'myclass'CLSID: '{3A14AB35-44BE-11D5-B155-00D0B7BA7544}'ProgID: 'my

Page 48 - Modifying Flags

Obtaining Registry InformationC-7ans =function [varargout] = randvectors()ans =function [x] = getdates(n, inc)ans =function Page = myprimes(n)The retur

Page 49

C Registration and VersioningC-8InterfacesAn array of structures defining all interface definitions in the type library. Each structure contains two f

Page 50 - Data Conversion Flags

Obtaining Registry InformationC-9CoClassesAn array of structures defining all COM classes in the component. Each structure contains these fields:•Name

Page 51

C Registration and VersioningC-10

Page 52

DUtility LibraryUtility Library Classes . . . . . . . . . . . . . . . D-3Class MWUtil . . . . . . . .

Page 53

D Utility LibraryD-2This section describes the MWComUtil library provided with the MATLAB Excel Builder. This library is freely distributable and incl

Page 54 - 4 Usage Examples

Utility Library ClassesD-3Utility Library ClassesThe Excel Builder Utility Library provides several classes:• “Class MWUtil” on page D-3• “Class MWFla

Page 55 - Creating the Project

D Utility LibraryD-4Return Value. None.Remarks. This function must be called once for each session of Excel that uses Excel Builder components. An err

Page 56 - Summary of Project Settings

Utility Library ClassesD-5Parameters.Return Value.None.Remarks. This function always frees the contents of pVarArg before processing the list.Example.

Page 57 - Building the Project

Typographical ConventionsxiiiTypographical ConventionsThis manual uses some or all of these conventions.Item Convention ExampleExample code Monospace

Page 58

D Utility LibraryD-6Dim aClass As ObjectDim aUtil As Object On Error Goto Handle_ErrorSet aClass = CreateObject("mycomponent.myclass.1_0"

Page 59

Utility Library ClassesD-7Return Value. None.Remarks. This function can process a Variant array in one single call or through multiple calls using the

Page 60

D Utility LibraryD-8Dim aUtil As ObjectDim v As VariantDim R1 As RangeDim R2 As RangeDim R3 As RangeDim R4 As Range On Error GoTo Handle_ErrorSet a

Page 61 - <matlab>\work, and the

Utility Library ClassesD-9method performs this transformation and additionally converts dates in string form to COM date types.Example. This example u

Page 62

D Utility LibraryD-10components contain a reference to an MWFlags object that can modify data conversion rules at the object level. This class contain

Page 63

Utility Library ClassesD-11Property InputArrayIndFlag As Long. This property governs the level at which to apply the rule set by the InputArrayFormat

Page 64

D Utility LibraryD-12Property OutputArrayIndFlag As Long. This property is similar to the InputArrayIndFalg property, as it governs the level at which

Page 65 - F2 and then Enter

Utility Library ClassesD-13function returns outputs as row vectors, and you desire to place the data into columns. The default value for this flag is

Page 66

D Utility LibraryD-14Example. This example uses data conversion flags to reshape the output from a method compiled from a MATLAB function that produce

Page 67 - F2 followed by Enter

Utility Library ClassesD-15Sub GenPrimes(R As Range, n As Double)Dim aClass As mycomponent.myclass On Error GoTo Handle_ErrorSet aClass = New mycom

Page 68

Prefacexiv

Page 69

D Utility LibraryD-16Remarks. Clone allocates a new MWFlags object and creates a deep copy of the object’s contents. Call this function when a separat

Page 70

Utility Library ClassesD-17Example. The following Visual Basic code illustrates use of the Initialize method to dimension struct arrays.Sub foo ()Dim

Page 71 - Use Handle Graphics library

D Utility LibraryD-18Parameters.Remarks.When accessing a named field through this property, you must supply all dimensions of the requested field as w

Page 72

Utility Library ClassesD-19• All indices and field name. This format accesses an array element of an multidimensional array by specifying n indices. T

Page 73

D Utility LibraryD-20Index1(1) = 1Index1(2) = 1Index2(1) = 3Index2(2) = 2x(Index1, Index2, 2, "red") = 0.5The last statement resolves to:x(1

Page 74

Utility Library ClassesD-21On Error Goto Handle_Error'' Call a method that returns an MWStruct in x'Dims = x.DimsFieldNames = x.FieldN

Page 75

D Utility LibraryD-22Example. The following Visual Basic example illustrates the difference between assignment and Clone for MWStruct objects.Sub foo

Page 76

Utility Library ClassesD-23Property Value As VariantStores the field’s value (read/write). The Value property is the default property of the MWField c

Page 77

D Utility LibraryD-24Property Real As VariantStores the real part of a complex array (read/write). The Real property is the default property of the MW

Page 78

Utility Library ClassesD-25MsgBox(Err.Description)End SubProperty MWFlags As MWFlagsStores a reference to an MWFlags object. This property sets or get

Page 79

1OverviewBuilding a Deployable Application . . . . . . . . . . 1-2Elements of an Excel Builder Project . . . . . .

Page 80

D Utility LibraryD-26Property NumRows As LongStores the row dimension for the array. The value of NumRows must be nonnegative. If the value is zero, t

Page 81 - ThisWorkbook object

Utility Library ClassesD-27MWSparse object has its own MWFlags property. This property overrides the value of the any flags set on the object whose me

Page 82

D Utility LibraryD-28cols(K) = I + 1vals(K) = -1K = K + 1rows(K) = Icols(K) = Ivals(K) = 2K = K + 1rows(K) = I + 1cols(K) = Ivals(K) = -1K = K + 1Next

Page 83 - Testing The Add-in

Utility Library ClassesD-29Property Value As VariantThe Value property stores the actual argument to pass. Any type that can be passed to a compiled m

Page 84 - Running the Test

D Utility LibraryD-30EnumerationsThe MATLAB Excel Builder Utility Library provides three enumerations (sets of constants):• “Enum mwArrayFormat” on pa

Page 85

EnumerationsD-31Enum mwDateFormatThe mwDateFormat enumeration is a set of constants that denote a formatting rule for dates. Table D-6 lists the membe

Page 86

D Utility LibraryD-32

Page 87

ETroubleshooting

Page 88

E TroubleshootingE-2This section provides a table showing errors you may encounter using MATLAB Excel Builder, probable causes for these errors, and s

Page 89 - Function Viewer

E-3LoadLibrary("component_name_1_0.dll") failed - The specified module could not be found. You may get this error message while registering

Page 90 - Using the Function Viewer

1 Overview1-2Building a Deployable ApplicationUsing MATLAB Excel Builder to create a deployable application is a simple process requiring a sequence o

Page 91 - Component Browser

E TroubleshootingE-4Table E-3: Function Wizard ProblemsProblem Probable Cause Suggested SolutionThe Function Wizard Help does not display.The Functio

Page 92 - Editing Required Inputs

I-1IndexAarray formatting flags 3-14CcapabilitiesExcel Builder viiiclass 1-2class methodcalling 3-6Class MWFlags D-9Class MWUtil D-3class name 1-2COMd

Page 93 - Properties button

IndexI-2IIDL Mapping A-8input command xiLlimitations xiMmbuild xmccsavepath xmethods 1-2missing parameter D-4MWFlags class D-9mwregsvr utility C-2MWUt

Page 94 - Editing varargin Inputs

Building a Deployable Application1-3organizational. As a general rule, when compiling many MATLAB functions, it helps to determine a scheme of functio

Page 95 - Editing Required Outputs

How to Contact The MathWorks:www.mathworks.com Webcomp.soft-sys.matlab [email protected] Technical [email protected] Product e

Page 96 - Editing varargout Outputs

1 Overview1-4Figure 1-1: MATLAB Excel Builder Main WindowFor a complete description of the features available from this window, see “Graphical User I

Page 97 - Input Argument Range

Building a Deployable Application1-5Figure 1-2: New Project Settings Dialog BoxComponent name denotes the name of the DLL created later in the build

Page 98 - Output Argument Properties

1 Overview1-6Note You can accept the automatically generated project directory path or choose another of your liking. Once you click OK on this menu,

Page 99 - Rename Function

Building a Deployable Application1-7Figure 1-3: Main Window with Options ActivatedAdd M- and/or MEX-files to the project by clicking the Add File but

Page 100 - Copy Function

1 Overview1-8Building a ProjectAfter you define your project settings and add the desired M- and MEX- functions, you can build a deployable DLL and th

Page 101 - Introduction

Building a Deployable Application1-9detailed discussion on integrating MATLAB Excel Builder components into Microsoft Excel via Visual Basic for Appli

Page 102 - 5 Function Wizard

1 Overview1-10Choose Component -> Package Component to create a self-extracting executable containing these files.The self-extracting executable is

Page 103 - Function Reference

2Graphical User InterfaceGraphical User Interface Menus . . . . . . . . . . . 2-2File Menu . . . . . . . . .

Page 104 - Description

2 Graphical User Interface2-2Graphical User Interface MenusThe MATLAB function mxltool displays the MATLAB Excel Builder graphical user interface (GUI

Page 105

Graphical User Interface Menus2-3File MenuThe File menu creates and manages MATLAB Excel Builder projects.•New Project opens the project settings dial

Page 106 - Syntax mxltool

iContentsPrefaceWhat Is MATLAB Excel Builder? . . . . . . . . . . . . . . . . . . . . . . . viiiSuggested Background . . . . . . . . . . . . . . .

Page 107 - Producing a COM Object

2 Graphical User Interface2-4• Remove File removes the currently selected files from the project. (The Remove button in the Project files frame of the

Page 108 - Capabilities

Graphical User Interface Menus2-5Help MenuThe Help menu provides access to the context-sensitive help for the MATLAB Excel Builder graphical user inte

Page 109

2 Graphical User Interface2-6Project SettingsChoosing New Project or Open Project from the File menu or Settings from the Project menu opens the appro

Page 110

Component Information2-7Component InformationThe Component Info choice under the Component menu displays the Component dialog box.This dialog presents

Page 111 - Step 3. C++ Compilation

2 Graphical User Interface2-8

Page 112

3Programming with Excel Builder ComponentsOverview . . . . . . . . . . . . . . . . . . . . . 3-2When to

Page 113 - COM Class.method

3 Programming with Excel Builder Components3-2OverviewEach MATLAB Excel Builder component is built as a stand-alone COM object. You access a component

Page 114 - IDL Mapping

When to Use a Formula Function or a Subroutine3-3When to Use a Formula Function or a SubroutineVisual Basic for Applications (VBA) provides two basic

Page 115 - Visual Basic Mapping

3 Programming with Excel Builder Components3-4Initializing Excel Builder Libraries with ExcelBefore you use any MATLAB Excel Builder component, initia

Page 116 - MATLAB Compiler Output

Initializing Excel Builder Libraries with Excel3-5This code is similar to the default initialization code generated in the VBA module created when the

Page 117 - Calling Conventions

ii Contents2Graphical User InterfaceGraphical User Interface Menus . . . . . . . . . . . . . . . . . . . . . . . . 2-2File Menu . . . . . . . . . .

Page 118

3 Programming with Excel Builder Components3-6Creating an Instance of a ClassBefore calling a class method (compiled MATLAB function), you must create

Page 119 - Data Conversion

Creating an Instance of a Class3-7Dim aClass As mycomponent.myclassOn Error Goto Handle_ErrorSet aClass = New mycomponent.myclass' (call some met

Page 120 - B Data Conversion

3 Programming with Excel Builder Components3-8The following example illustrates this technique with the second method.Dim aClass As mycomponent.myclas

Page 121 - Data Conversion Rules

Calling the Methods of a Class Instance3-9Calling the Methods of a Class InstanceAfter you have created a class instance, you can call the class metho

Page 122

3 Programming with Excel Builder Components3-10aClass = CreateObject("mycomponent.myclass.1_0")Call aClass.foo(1,y,x1,x2)foo = yExit Functio

Page 123

Processing varargin and varargout Arguments3-11Processing varargin and varargout Arguments When varargin and/or varargout are present in the original

Page 124

3 Programming with Excel Builder Components3-12Dim aUtil As ObjectDim v As Variant On Error Goto Handle_ErroraUtil = CreateObject("MWComUtil.MWUt

Page 125

Handling Errors During a Method Call3-13Handling Errors During a Method CallErrors that occur while creating a class instance or during a class method

Page 126

3 Programming with Excel Builder Components3-14Modifying FlagsEach MATLAB Excel Builder component exposes a single read/write property named MWFlags o

Page 127

Modifying Flags3-15x(1,2) = 12x(2,1) = 21x(2,2) = 22var2 = xSet aClass = New mycomponent.myclassCall aClass.foo(1,y1,var1)Call aClass.foo(1,y2,var2)Ex

Page 128

iii4Usage ExamplesMagic Square Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2Creating the Project . . . . . . . . . .

Page 129

3 Programming with Excel Builder Components3-16the resulting array. If this flag is not set, the target range must be at least as large as the output

Page 130

Modifying Flags3-17Handle_Error:MsgBox(Err.Description)End SubThis example converts var1 of type Variant/Integer to an int16 and var2 of type Variant/

Page 131

3 Programming with Excel Builder Components3-18Sub foo(y1 As Variant, y2 As Variant)Dim aClass As mycomponent.myclassDim ytemp As MWArgDim today As Da

Page 132 - OutputAsDate As Boolean

4Usage ExamplesMagic Square Examples . . . . . . . . . . . . . . . 4-2Creating the Project . . . . . . .

Page 133 - DateBias As Long

4 Usage Examples4-2Magic Square ExamplesThe M-file mymagic takes a single input, an integer, and creates a magic square of that size.The Excel file my

Page 134

Magic Square Examples4-3Creating the ProjectFigure 4-1: Empty New Project Settings Dialog BoxFrom the MATLAB command prompt change directories to <

Page 135 - Versioning

4 Usage Examples4-4• Select C as the code to compile in.• Leave all Compiler options unselected.The New Project Settings dialog now looks like Figure

Page 136 - C Registration and Versioning

Magic Square Examples4-5Build debug version = NoShow verbose output = NoBuilding the Project• From the Excel Builder graphical user interface click Ad

Page 137 - Component Registration

4 Usage Examples4-6Illustration 2. Transpose the OutputReopen the Macro dialog, select the mymagic_transpose macro and click the Run button. This proc

Page 138

Magic Square Examples4-7Inspecting the Visual Basic CodeOn the Excel main window select Visual Basic Editor from the Tools -> Macro menu.From the V

Page 139

iv ContentsFunction Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3Component Browser . . . . . . . . . . . .

Page 140

4 Usage Examples4-8Using Multiple Files and Variable ArgumentsThe M-file, myplot, takes a single integer input and plots a line from 1 to that number.

Page 141

Using Multiple Files and Variable Arguments4-9Figure 4-7: Empty New Project Settings DialogOn the New Project Settings dialog, enter the settings as

Page 142

4 Usage Examples4-10The New Project Settings dialog now looks like Figure 4-8.Figure 4-8: New Project Settings with Entries• Click OK to create the x

Page 143

Using Multiple Files and Variable Arguments4-11Building the Project• From the Excel Builder graphical user interface click Add File … .• Select the fi

Page 144

4 Usage Examples4-12Figure 4-9: mymulti.xls

Page 145 - Utility Library

Using Multiple Files and Variable Arguments4-13Illustration 4: Calling myplot This illustration calls the function myplot with a value of 4. To execut

Page 146 - D Utility Library

4 Usage Examples4-14Figure 4-11: myplot OutputIllustration 5: Calling mysum Four Different WaysThis illustration calls the function mysum in four dif

Page 147 - Utility Library Classes

Using Multiple Files and Variable Arguments4-15Figure 4-12: Four Different Calls to mysumThis illustration runs when the Excel file is opened. To rea

Page 148

4 Usage Examples4-16Figure 4-14: myprimes Output for Value of 10This function automatically resizes if the returned output is larger than the output

Page 149

Using Multiple Files and Variable Arguments4-17Figure 4-16: Visual Basic Code for mymulti.xls

Page 150

vCRegistration and VersioningComponent Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2Self-Registering Components . .

Page 151

4 Usage Examples4-18Spectral Analysis ExampleThis example illustrates the creation of a comprehensive Excel add-in to perform spectral analysis. It re

Page 152 - Sub MWDate2VariantDate(pVar)

Spectral Analysis Example4-19 powerspect = []; return; end if (interval <= 0) error('Sampling interval must be grea

Page 153 - Class MWFlags

4 Usage Examples4-20See “Project Settings” on page 2-6 for a description of new project settings.3 Add the computefft.m and plotfft.m M-files to the p

Page 154

Spectral Analysis Example4-21Figure 4-17: VBA Project: Insert->Module3 Enter the following code in the FourierMain module:'' FourierMain

Page 155

4 Usage Examples4-22Private Sub LoadFourier()'Initializes globals and Loads the Spectral Analysis form Dim MainForm As frmFourier On Error

Page 156

Spectral Analysis Example4-23Figure 4-18: Creating the Visual Basic Form3 Now add a series of controls to the blank form to complete the dialog, as s

Page 157

4 Usage Examples4-24RefEdit refedtInputSelects range for input data.Label Label2Caption = Sampling Interval Labels the TextBox for sampling interval.C

Page 158

Spectral Analysis Example4-25Figure 4-19, Layout of Controls on Main Form, on page 4-26 shows the controls layout on the form.CommandButton btnOKCapti

Page 159 - Sub Clone(ppFlags As MWFlags)

4 Usage Examples4-26Figure 4-19: Layout of Controls on Main FormWhen the form and controls are complete, right-click on the form and select View Code

Page 160

Spectral Analysis Example4-27''frmFourier Event handlers'Private Sub UserForm_Activate()'UserForm Activate event handler. This fun

Page 161

vi Contents

Page 162

4 Usage Examples4-28 'Process inputs Set R = Range(refedtInput.Text) If Err <> 0 Then MsgBox ("Invalid range entered f

Page 163

Spectral Analysis Example4-29Adding The Spectral Analysis Menu Item to ExcelThe last step in the integration process adds a menu item to Excel so that

Page 164 - Property Dims As Variant

4 Usage Examples4-30Private Sub Workbook_AddinInstall()'Called when Addin is installed Call AddFourierMenuItemEnd SubPrivate Sub Workbook_Addi

Page 165

Spectral Analysis Example4-312 When the Workbook Properties dialog appears, select the Summary tab and enter Spectral Analysis as the workbook title.3

Page 166 - Property Name As String

4 Usage Examples4-3215 and 40 Hz. Sample the signal for 10 seconds at a sampling rate of 0.01 sec. Put the time points into column A and the signal po

Page 167 - Sub Clone(ppField As MWField)

Spectral Analysis Example4-33Figure 4-21: Worksheet with Inputs and Outputs for Test ProblemThe power spectral density reveals the two signals at 15

Page 168 - Property Imag As Variant

4 Usage Examples4-34Package the Add-inAs a final step, package the add-in, the COM component, and all supporting libraries into a self-extracting exec

Page 169

5Function WizardIntroduction . . . . . . . . . . . . . . . . . . . . 5-2Installing the Function Wizard Add-i

Page 170

5 Function Wizard5-2IntroductionThe Function Wizard enables you to pass Microsoft Excel (Excel 200 or later) worksheet values to a compiled MATLAB mod

Page 171

Introduction5-3To start the Function Wizard, click on Tools -> MATLAB Functions on the Excel menu bar. The starting point of the Function Wizard, c

Page 172

PrefaceWhat Is MATLAB Excel Builder? . . . . . . . . . . . viiiSuggested Background . . . . . . . . . . .

Page 173 - Sub Clone(ppArg As MWArg)

5 Function Wizard5-4The Function Viewer controls the execution of worksheet functions. Use the Function Viewer to organize the list of all currently l

Page 174

Introduction5-5Component BrowserThe Component Browser lists all MATLAB Excel Builder components currently installed on the system. When you click the

Page 175 - Enum mwDateFormat

5 Function Wizard5-6Function PropertiesThis group of dialog boxes sets properties and values for the inputs and outputs. You can map inputs and output

Page 176

Introduction5-7Editing Function Arguments. Function arguments may be either required arguments or varargin/varargout arguments: • Required arguments a

Page 177 - Troubleshooting

5 Function Wizard5-8Editing varargin InputsAdd new varargin argument to list.Delete selected varargin argument.Return to Function Viewer.Invoke help.S

Page 178 - E Troubleshooting

Introduction5-9Editing Required Outputs• The Add and Delete buttons become active when you select varargout Arguments. • Select the Inputs tab to swit

Page 179 - Security Level tab

5 Function Wizard5-10Editing varargout OutputsAdd new varargout argument to list.Delete selected varargout argument.Return to Function Viewer.Invoke h

Page 180

Introduction5-11Argument PropertiesThe Argument Properties and related dialog boxes allow you to select worksheet ranges or optionally enter a specif

Page 181 - Enumeration

5 Function Wizard5-12Input Argument ValueOutput Argument PropertiesEnter value for current argument.Save and return to Function Viewer.Automatically r

Page 182

Introduction5-13Function UtilitiesRename FunctionUse this dialog box to rename a function. When you click the Rename button on the Function Viewer, th

Commentaires sur ces manuels

Pas de commentaire