LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Output 1D string array from MathScript node

Solved!
Go to solution

I'm using cell arrays inside a MathScript Node and want to output a 1D String Array.  I can't get an output with that data type by selecting a column of string elements.  It seems to treat the strings as character arrays which are extremely awkward to work with.

I've seen 2008 references that say Mathscript Nodes cannot output String Arrays,

 

Is that still true?  Is there an example of how to get a string out or some kind of workaround?

0 Kudos
Message 1 of 8
(9,911 Views)

You should be able get an array of strings out. See this page for more details:

http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmathmain/ms_passing_data_lv_mathscript/

0 Kudos
Message 2 of 8
(9,871 Views)

I have previously looked at that "example".  The only string array output is the string array input - not processed in any way.  That's not a very helpful example.

0 Kudos
Message 3 of 8
(9,868 Views)

Does this example help? If not, could you post some sample code?

0 Kudos
Message 4 of 8
(9,852 Views)

%Create cell array


exampleCell(1,:)={20 5 100 500}
exampleCell(2,:)={'20 sccm','5 sccm','100 sccm','500 sccm'}

for k=1:4
stringCells(k)=exampleCell{2,k}
end

 

The example given to me does work, if the strings are built up from individual elements.

The problem I am having is extracting a 1D cell array which I should be able to export, appearing as a 1D string array in LabVIEW.

 

I know I have mixed types in the Cell Array, but I am only extracting cells which contain strings so I should be able to export.

 

The problem is that the indexing shown in My sample code:

 stringCells(k)=exampleCell{2,k}

doesn't work.

I get error -90028 "...number of indexes much match number of values..."

 

There must be some way to address a cell array, extract a 1D subset containing only strings and export that.

Any ideas?

0 Kudos
Message 5 of 8
(9,820 Views)

Great - my ":" colons in my sample code got replaced with emoticons.  Any way to prevent this?

0 Kudos
Message 6 of 8
(9,819 Views)

The emoticons should be replaced  ":)"  

0 Kudos
Message 7 of 8
(9,818 Views)
Solution
Accepted by topic author wildcatherder

My boss came up with a way to do it, as shown in the attached VI.  

 
The "magic" appears to be taking place on line 18 when the subset array is addressed by the      .Name appellation.
Although the integers "MaxRange" can be addressed with the expected two-index identifier   "    j,1   "   
the string inside the cluster element must be addressed more explicitly.
 
I don't know why but it works.  I've asked National Instruments for clarification on why this additional level of addressing is necessary for strings.
0 Kudos
Message 8 of 8
(9,814 Views)