MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

MATRIXx Dimensions parameter incoreect using Createblock

When I use the Createblock function and specify a dimension other that one, the resulting block has a dimension of one instead of what I specified. For example,

createblock "ReadVariable", {Name="test",DataType="LOGICAL",Dimensions=9,Variable="testvar",Outputs=1,Outputlabel="testout",Indices=1,Labels="on",location=[100,100],Addressing="Element",color=0,id=100}

will create a block of a single dimension (1) instead of nine (9).

I am using MATRIXx 7.1 on the PC platform. I did see this problem using MATRIXx 5.0.22 on the Unix platform.
0 Kudos
Message 1 of 2
(7,088 Views)
What you are seeing is due to the order of the keywords. Most of the time in Xmath the order of the keywords are not important. This however is not always the case with SBA, where there are interdependencies between the keywords. The keywords are interpreted left to right. More information about this is in the Using SBA section of the SystemBuild Users Manual in Chapter 7 SystemBuild Access. A simple example from the manual is the following command:
createblock "gain",{outputlabel=["A","B","C"], outputs=3}
In this case only one label will be create, because at the time that outputlabel is evaluated then there is only one output.

Similarly in your case, in order to have Dimensions and Outputs be different the Addressing must be Element. However since Addressing is not set until later, when the Outputs keyword is interpreted it also sets the Dimensions to be 1. Move Addressing earlier in the keyword list to resolve the problem:
createblock "ReadVariable", {Name="test",DataType="LOGICAL",Addressing="Element",Dimensions=9,Variable="testvar",Outputs=1,Outputlabel="testout",Indices=1,Labels="on",location=[100,100],color=0,id=100}

Another good idea when working with SBA is to create a block interactively and then use the ExportSuperblock command. This command will create a MathScript Command file (msc) with the correct syntax to recreate the SuperBlock using SBA.

Carl L
National Instruments
www.ni.com/matrixx
0 Kudos
Message 2 of 2
(7,081 Views)