LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenate Elements of a 1D array

As others pointed, unless you give proper inputs it's difficult to understand by simply giving one sentence.

-Take one string as sample and show what should be the output. 

-Just for example if your string input is "AB" write down in paper atleast all the steps and show us final answer you are expecting.

-If you want ASCII value or decimal or hex value please check and write down the same.:

https://simple.wikipedia.org/wiki/ASCII

Thanks
uday
0 Kudos
Message 11 of 14
(1,767 Views)

Hi algo,

 

my first 2 elements are 49, and 100, but when they get combined it becomes 12645...

By using JoinNumbers you basically do simple math like "a*256+b" (when joining bytes), which would result in 49*256+100=12644.

I really don't know how you get 12645 as result…

Have you been told to provide meaningful data and expected results for this data?

 

but I want it to be "49100" any ideas?

This looks like a using FormatIntoString with formatcode %d%d…

 

I repeat from my previous post: Or any other operation you would like to do, it's not quite clear from your question!

Have you been told to provide data and expected results for that data before?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 14
(1,756 Views)

OK, my colleagues are obviously not being clear when they ask you to "Post your VI".  Here's what we want you to do:

  1. Open the VI that you are using to do this task.
  2. Put values in it and run it a few times, getting (probably) the "wrong" answer.
  3. Open its Front Panel, click on Edit, and click "Make Current Values Default" (this "freezes" the values you last used that give the "wrong" result).
  4. Save the VI (you can give it a unique name, if you wish).
  5. Come back to the Forum.  Choose "Reply".  Write a message that says "Attached please find my VI".
  6. At the bottom of the message, click the "Choose File" button.  Navigate to the VI you saved in Step 4 and select it.
  7. Now click "Post".

The reason we want VIs (and not "static pictures" of parts of the VI) is that we can examine everything, execute the code to see what it does, and modify it without, ourselves, having to duplicate all of your wires (perish forbid we make a mistake!).  You want us to help you -- we are telling us that you need to help us in order for us to help you.  You can refuse, of course, but don't complain ...

 

Bob Schor

0 Kudos
Message 13 of 14
(1,730 Views)

As bob already said, we are going in circles unless you attach actual code with typical default values.

 


@algoballer wrote:

Hello,

Fairly simple question I'm just looking for an efficient way to do it..

So does your code work correctly, but is just inefficient? It seems your code does NOT work correctly, so first get it to produce the right output and let's worry about efficiency later.

 


@algoballer wrote:

 

I have a 1D array of HEX values and I would like to be able to combine 2 elements into 1 through out the whole array.

 


The term "Hex values" can mean many different things. Most often it designates a way to format binary values as a human readable string using the characters 0..9, A..F Where does the original string come from? Are there really tabs as delimiters? What sizes are the fields (fixed, variable, etc). What does the "20" stand for and why is it there? Are all field strings of the same lenght? The "reshape array" function seems to severly truncate the data, so why are you processing all of it in the first place?

 


@algoballer wrote:

 

Ex: elements[0] and element[1] become element[0]. element[2] and [3] become element[1] etc.


So, what is the desired datatype of the new element?

 


@algoballer wrote:

 

I have attached an image to show what I am doing. I take a string, convert to hex and then into a 1D array. But ultimately I need to convert 2 ascii character into 1 hex! As of right now I have 1 ascii gets converted into 1 hex.

 


ASCII defines a way to translate bit patterns into defined characters and control codes and seems unrelated to your problem. What is "1 hex"? Your entire description makes no sense. The image does NOT show what you are doing.

 

0 Kudos
Message 14 of 14
(1,712 Views)