虚拟仪器技术-实验.ppt_第1页
虚拟仪器技术-实验.ppt_第2页
虚拟仪器技术-实验.ppt_第3页
虚拟仪器技术-实验.ppt_第4页
虚拟仪器技术-实验.ppt_第5页
已阅读5页,还剩69页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

虚拟仪器技术 数组自动索引数组函数函数的多态性 Lesson4数组 Arrays 数组是相同类型数据的集合有一维数组和多维数组 每一维的元素个数最多可达2 1通过索引 可访问每一个数组元素 元素的索引值从0开始 31 index10 elementarray 2Darray Fiverowbysevencolumnarrayof35elements 0123456 0 1 2 3 4 数组 AddDimensionfor2Darrays 1 SelecttheArrayshellfromtheControlspalette 2 Placedataobjectinsideshell ArrayControlsandIndicators 1 SelectArrayConstantshellfromtheArraysubpalette 2 Placethedataobjectinthearrayshell CreatingArrayConstants Loopscanaccumulatearraysattheirboundarieswithauto indexingForLoopsauto indexbydefaultWhileLoopsoutputthefinalvaluebydefaultRight clickontunnelandenable disableauto indexing 利用循环的自动索引功能创建数组 Wirebecomesthicker Wireremainsthesamesize Auto IndexingDisabled Auto IndexingEnabled Onlyonevalue lastiteration ispassedoutoftheloop 1DArray 012345 内层FoorLoop产生列元素外层FoorLoop产生行元素 创建二维数组 1DArray 012345 2DArray 自动索引输入 将自动把循环次数设置为数组长度计数端口数等于数组中元素数 ArraySize InitializeArray 数组函数 ArraySubset 数组函数 BuildArray 构建数组 函数 Buildingahigherdimensionarray ConcatenateInputs Appendinganelement default IndexArray 索引数组 函数 ExtractinganElement ExtractinganElementofaRow ExtractingaRow 函数可以接收不同类型 不同维数或不同表示法的输入数据的能力 Scalar Scalar Array Scalar Combination Result Scalar Array Array Array Array Array Array Array 函数的多态性 Polymorphism 概念 Arraysgroupdataelementsofthesametype Youcanbuildarraysofnumeric Boolean path string waveform andclusterdatatypes Thearrayindexiszero based whichmeansitisintherange0ton 1 wherenisthenumberofelementsinthearray Tocreateanarraycontrolorindicator selectanArrayontheControls Array Clusterpalette placeitonthefrontpanel anddragacontrolorindicatorintothearrayshell IfyouwireanarraytoaForLooporWhileLoopinputtunnel youcanreadandprocesseveryelementinthatarraybyenablingauto indexing Bydefault LabVIEWenablesauto indexinginForLoopsanddisablesauto indexinginWhileLoops Polymorphismistheabilityofafunctiontoadjusttoinputdataofdifferentdatastructures Summary 簇簇函数ErrorClusters Lesson5簇 Clusters 簇 簇是相同或不同类型的数据的集合簇类似于在C语言中的结构簇中的所有元素必须同时为控制件 或者同时为显件 在前面板上创建簇 1 SelectaClustershellfromtheArray Clustersubpalette 2 Placeobjectsinsidetheshell 在程序框图中创建簇常量 1 SelectClusterConstantshellfromtheClustersubpalette 2 PlaceobjectsintheClustershell 簇的顺序 Elementshavealogicalorder startwith0 Tochangeorder right clicktheborderandselectReorderControlsinCluster 使用簇与子VI交换数据 UseclusterstopassseveralvaluestooneterminalOvercomes28 terminallimitSimplifieswiring 簇函数 Bundle Bundle BundleByName Createnewcluster Modifyexistingcluster Musthaveanexistingclustertousethisfunction 簇函数 Unbundle Unbundle UnbundleByName ErrorCluster UsetheerrorinanderroroutclustersineachVIyouuseorbuildtohandleerrorsintheVI TheerrorclusterslocatedontheControls Array Clusterpaletteincludethecomponentsofinformationshown ErrorClusterDetails StatusisaBooleanvaluethatreportsTRUEifanerroroccurred MostVIs functions andstructuresthatacceptBooleandataalsorecognizethisparameter Codeisasigned32 bitintegerthatidentifiestheerrornumerically Anon zeroerrorcodecoupledwithastatusofFALSEsignalsawarningratherthanafatalerror Sourceisastringthatidentifieswheretheerroroccurred ErrorHandlingwithClusters LabVIEWdoesnothandleerrorsautomatically InLabVIEW youcanmaketheseerrorhandlingdecisionsontheblockdiagramoftheVI ErrorhandlinginLabVIEWfollowsthedataflowmodel JustasdataflowthroughaVI socanerrorinformation WiretheerrorinformationfromthebeginningoftheVItotheend ErrorCluster SimpleErrorHandler UsetheSimpleErrorHandlertohandletheerrorattheendoftheexecutionflow TheSimpleErrorHandlerislocatedontheFunctions AllFunctions TimeandDialogpalette WiretheerrorclustertotheErrorIn noerror input UsingWhileLoopsforErrorHandling YoucanwireanerrorclustertotheconditionalterminalofaWhileLooptostoptheiterationoftheWhileLoop OnlytheTRUEorFALSEvalueofthestatusparameteroftheerrorclusterispassedtotheterminal Whenanerroroccurs theWhileLoopstops Clustersgroupdataelementsofmixedtypes Aclustercannotcontainamixtureofcontrolsandindicators Tocreateaclustercontrolorindicator selectaclusterontheControls Array Clusterpalette placeitonthefrontpanel anddragcontrolsorindicatorsintotheclustershell UsetheClusterfunctionslocatedontheFunctions AllFunctions Clusterpalettetocreateandmanipulateclusters Errorcheckingtellsyouwhyandwhereerrorsoccur Theerrorclusterreportsthestatus codeandsourceoftheerror UsetheerrorclustercontrolsandindicatorstocreateerrorinputsandoutputsinsubVIs Summary WaveformChartWaveformGraphXYGraphsIntensityGraph Lesson6数据图形显示 WaveformCharts SelectedfromtheControls GraphsandChartspalette 滚动显示模式 整屏刷新模式 扫描刷新模式 WiringtoCharts 单曲线显示多曲线显示 ModifyingChartProperties 外观设置刻度的数据格式与精度设置曲线样式设置刻度设置对象的说明 控件ChartsandGraphs Right clickandselectVisibleItemstoviewthefollowingitems PlotLegendDigitalDisplayScrollbarXandYScaleGraphPaletteScaleLegend GraphPalette ScaleLegend SelectedfromtheGraphsubpalette WaveformGraph Plotanarrayofnumbersagainsttheirindices PlotLegend pointandlinestyles GraphPalette ScaleLegend Graphs 初始值X0 0 0步长值 X 1 0 初始值X0 3 0步长值 X 5 0 单曲线数据类型 多曲线数据类型 两个波形数组 初始值X0 0 0步长值 X 1 0 由两个簇构成波形数组 初始值X0 3 0步长值 X 0 5 初始值X0 3 0步长值 X 0 2 SeparateXandYarraysdefinedatapointsXYGraph Plotonearrayagainstanother XYGraphs ChartandGraphUseSummary UsetheContextHelpwindowwithchartsandgraphs IntensityPlotsandGraphs 强度图形控件提供了一种在二维平面上表现三维数据的方法 例如可以用屏幕色彩的亮度来反映来反映一个二维数组元素值的大小 注意 x y轴刻度对应的是数组行 列的序号 Thewaveformchartisaspecialnumericindicatorthatdisplaysoneormoreplots Thewaveformcharthasthefollowingthreeupdatemodes Astripchartshowsrunningdatacontinuouslyscrollingfromlefttorightacrossthechart Ascopechartshowsoneitemofdata suchasapulseorwave scrollingpartwayacrossthechartfromlefttotheright Asweepworkssimilarlytoascopeexceptitshowstheolddataontherightandthenewdataontheleftseparatedbyaverticalline WaveformgraphsandXYgraphsdisplaydatafromarrays Right clickawaveformchartorgraphoritscomponentstosetattributesofthechartanditsplots Summary YoucandisplaymorethanoneplotonagraphusingtheBuildArrayfunctionandtheBundlefunctionforchartsandXYgraphs Thegraphbecomesamultiplotgraphwhenyouwirethearrayofoutputstotheterminal Whenyouwiredatatochartsandgraphs usetheContextHelpwindowtodeterminehowtowirethem Youcanuseintensitychartsandgraphstoplotthree dimensionaldata Thethirddimensionisrepresentedbydifferentcolorscorrespondingtoacolormappingthatyoudefine Intensitychartsandgraphsarecommonlyusedinconjunctionwithspectrumanalysis temperaturedisplay andimageprocessing Summary cont 字符串字符串函数文件输入操作文件输出操作 Lesson7字符串和文件存取 Astringisasequenceofdisplayableor characters ASCII Manyuses displayingmessages instrumentcontrol fileI OStringcontrol indicatorisintheControls String Pathsubpalette 字符串 StringDisplayModes NormaldisplayPassworddisplay codedisplayHexdisplay ConcatenateStrings spaceshere StringLength StringFunctions StringFunctions StringSubset MatchPattern ConvertingNumericstoStrings BuildString Function output ConvertingStringstoNumerics ScanFromString EditFormatString ScanFromStringFunction FileInputandOutput FourHierarchyLevels High levelFileVIsIntermediateFileVIsandFunctionsAdvancedFileFunctionssubpaletteExpressVIs WritetoSpreadsheetFileReadfromSpreadsheetFileWriteCharacterstoFileReadCharactersfromFileReadLinesfromFile High levelFileI OVIs 文件操作的基本步骤 Open Create ReplaceFile Readand orWritetoFile CloseFile CheckforErrors WritetoFileExample Open Create ReplaceopenstheexistingfileTEST1 DATandgeneratesrefnumanderrorclusterWriteFilewritesthedataCloseFileclosesthefileSimpleErrorHandlerchecksforerrors ReadingDatafromaFile Open Create ReplaceopensthefileReadFilereadsthespecifiednumberofbytesfromthefileCloseFileclosesthefileSimpleErrorHandlerchecksforerrors FormattingaSpreadsheetString SpreadsheetsarepopulartoolsfordatahandlingandanalysisTherearemanyformatsforspreadsheetdata Oneofthemostpopularistab delimited ColumnsareseparatedbyatabcharacterRowsareseparatedbyanend of linecharacter Tab EndofLine Aspreadsheetyields CreatingaSpreadsheetFile CanreplaceFormatIntoStringandWriteFilewithFormatIntoFileinaboveexample WriteLabVIEWMeasurementFile Includestheopen write closeanderrorhandlingfunctionsHandlesformattingthestringwitheitherataborcommadelimiterMergeSignalsfunctionisusedtocombinedataintothedynamicdatatype StringsgroupsequencesofASCIIcharacters UsethestringcontrolandindicatorlocatedontheControls String Pathpalettetosimulatetextentryboxesandlabels UsetheStringfunctionslocatedontheFunctions Stringpalettetoeditandmanipulatestringsontheblockdiagram UsetheFormatIntoStringfunctionandtheBuildStringExpressVItoconvertanumerictoastring UsetheScanFromStringfunctiontoconvertastringtoanumeric Right clicktheFormatIntoStringorScanFromStringfunctionandselectEditFormatStringorEditScanStringfromtheshortcutmenutocreateoreditaformatstring Summary UsetheFileI OVIsandfunctionslocatedontheFunctions FileI OpalettetohandleallaspectsoffileI O Whenwritingtoafile youopen create orreplaceafile writethedata andclosethefile Similarly whenyoureadfromafile youopenanexistingfile read

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论