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

cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt about matrix or array

Solved!
Go to solution

I need to write some values that I'm reading by the serial port. But I need to increment the column automatically each new number. 

 

What it is happening is that each new number, the last one turns to zero and I lost the number.

 

How can I store the last number and receive the number at the next column?

 

Regards.

0 Kudos
Message 1 of 32
(3,256 Views)
Through the power of telepathy: stop using locals and start using shift registers. If you post your vi you may get aore sensible answer!
0 Kudos
Message 2 of 32
(3,249 Views)

Sorry,

 

I forgot to send the .vi. Here it is.

0 Kudos
Message 3 of 32
(3,242 Views)

@Michael_78 wrote:
Through the power of telepathy: stop using locals and start using shift registers. If you post your vi you may get aore sensible answer!

[Opens VI]

 

Nope, you were wrong no locals

 

[Looks closer]

 

...Oh well he also isn't using a shift register for the array so every time you run you will be replacing the values and never keeping a history.

 

Poster please explain a little more what you need.  I can suggest that you should make your arrays to to the shift register so you can keep its history and replace data each iteration instead of replacing data and then never using that data the next time the loop runs.

0 Kudos
Message 4 of 32
(3,230 Views)

No shift register was most likely so surely i get points for that Smiley Wink  Locals? that was just my wildcard, figured i had good odds but thats why i play with matchsticks

0 Kudos
Message 5 of 32
(3,222 Views)

Hooovahh,

 

I need to keep the hystory of the last number and keep incrementing the column to each new number.

 

Like:

 

I receive [1,2,3,4,5], for example.

 

With my code, I receive: [1] than [0,2], than [0,0,3] than [0,0,0,4] than [0,0,0,0,5]

 

But I want this: [1,2,3,4,5]. 

 

Hope I was clear now.

 

Regards.

0 Kudos
Message 6 of 32
(3,205 Views)

Your explaination is still ambiguous but I implemented the code the way you described it which I don't think is the way you actually want it.

 

If you put in [1] then click Simulate a Read, then enter [0 2], then read, then [0 0 3] then read, and then for 4 and 5 you will have the result you want [1 2 3 4 5] but this relies on always having the array size increase by one, and always starting at size 1, and always having your newest relavent data at the last value in the data you read.

0 Kudos
Message 7 of 32
(3,199 Views)

I appreciate your response, but it wasn't like that.

 

I will try to explain again, hahaha.

 

I will receive the numbers by the Serial port, ok? 

 

I need to put these numbers in order in a array, one after the other, but keeping the number that I received before. 

 

With my code I can increment the column, but I can't keep the hystory. At each new number that I receive, the last one turns to zero and I only see the new one.

 

Will not me that will put the numbers at the array. I will receive all the number by the Serial port, I need to align these number in order one after the other.

 

Was better now?

 

 

 

 

0 Kudos
Message 8 of 32
(3,188 Views)

First, let's clarify that you actually have a question about your VI and not a doubt.  You don't have a doubt because you know it doesn't work.

 

It sounds like all you need is a shift register to maintain the array, and a Build Array in the case structure that will put the incoming data at the end of the array.  I think your description is confusing people into thinking you want to do something more complicated than you actually want to do.

0 Kudos
Message 9 of 32
(3,176 Views)

I'm probably not expressing myself correctly, I'm sorry about that.

 

But I think you undertood what I'm trying to do. Could you send me a photo about the code that you said?

 

Regards 

0 Kudos
Message 10 of 32
(3,150 Views)