From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Empty 1D array

Solved!
Go to solution

Hi

 

I want to declare an empty 1D array in MathScriptRT node.

 

This code give a 2D array.

a = [];

 

I know in Matlab the above code will give me an empty 1D array.

Could anyone tell me how to declare it?

I am using LabVIEW 2013sp1.

Thanks

0 Kudos
Message 1 of 6
(7,134 Views)

I found a solution

a = zeros(1, 0);

 

But I am not happy with it. I need a simpler way.

0 Kudos
Message 2 of 6
(7,130 Views)
Solution
Accepted by topic author fucai1116

A simpler way would be not to use mathscript at all and simply use an empty 1D array diagram constant. 😄

0 Kudos
Message 3 of 6
(7,128 Views)

It does not like what NI advertised that most of basic MATLAB code can run on MathScript.

0 Kudos
Message 4 of 6
(7,089 Views)
Solution
Accepted by topic author fucai1116

@fucai1116 wrote:

It does not like what NI advertised that most of basic MATLAB code can run on MathScript.


What is "it"?

 

Maybe you are mistaken in your assumption? Looking at the matlab help,

 

a = [];

 

will create a 0x0 array, which is by definition 2D, right? A matrix of zero columns and zero rows!

 

 

0 Kudos
Message 5 of 6
(7,085 Views)

HI altenbach

 

I was mistaken. I did not check carefully. a = [] will create 0x0 matrix.

 

Thank you

0 Kudos
Message 6 of 6
(7,030 Views)