10-22-2015 09:17 AM
First off, this is a school problem. The goal to create a VI that reads 20 temperature readings and bundles these with the time of the measurement. I have created a VI that executes this, but I am not pleased with my results. Below is the VI, the Front Panel is just an waveform chart with Time as x-axis and temperature as the y-axis.
For the sake of simplicity the VI works. But I want to do more and see if I can create an output array that relates the 20 temperature measurements like below:
The problem is I cannot figure out how to make a 2d output array, or 2 1d arrays function with the recorded temperature and time moving down the arrays. I want to start the VI, and the sample temperature and respective time move down the array. I cannot figure this out and I would like some guidance in what specifically I can do to make this work. Below was my attempt at initializing the arrays, using my inputs, and produce my output cluster as seen above. I cannot figure out what I am doing wrong here, and I have wasted a lot of time and resources trying to figure it out. Can someone point me in the right direction?
Thank you
Solved! Go to Solution.
10-22-2015 09:26 AM - edited 10-22-2015 09:28 AM
Thanks for attempting the problem before coming to us, this goes a long way on the forums. When you share code, please include a Snippet of your code, or attach your VIs, so that we can better assist you. We are here to help, but won't spend all day recreating your code from scratch.
What you're running in to is a problem with mixing a bundle of arrays and an array of bundles. Your last code there doesn't make much sense... You're creating 2D arrays and then creating an array of bundles of arrays...
I think this is what you want to do:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-22-2015 09:29 AM
Normally I would create an array of a cluster than contains my temperature and timestamp points. This way you can scroll the cluster array and the points stay in sync.
For my user interfaces, though, I normally put this information into a table control (by converting the data to a string first) as it looks a bit nicer:
10-22-2015 10:00 AM
These should give you some ideas. There are so many ways to do things when programming it is impossible to think of all of them. Sometimes I find myself looking back at some old code that I've written and wondering what the heck I was thinking at the time. You'll still have to think your way through to solve the full problem.
These are in 2014, but I have included screenshots.
10-22-2015 08:18 PM
Thank you gentlemen. I’ve abandoned the last VI I had put together and kept the first one. For some reason I was thinking that I needed the two ‘Insert Into Array’ functions to input the data into the cluster, then to the arrays within the cluster. The initialization was at the beginning to reset the array, not necessarily required. I feel pretty dumb right now. I can see where I was going wrong now.
For the VI file, I was trying to avoid posting it: 1) I don't just want someone to do the work for me; give some guidance and let me figure it out. 2) I don't want someone to just copy my file and use it themselves.
But as always I have more questions now; if you guys could help answer them.
What is the idea behind adding dimensions to arrays? Say I wanted a 10x3 (column x row) array. Does the data populate from left to right, top to bottom? How would I feed data to an array that has multiple dimensions? Is there a way to control the data to these dimensions?
If I wanted to convert the data to string for the use in the table example, how would I convert it? Would I use the ‘Format into String’ function? How do I get the data to display on each column of the table? Is it the same as using the ‘Bundle’ function for the array? First connection is first column?
Sorry for the questions. I just want to understand.
10-22-2015 09:00 PM
@HellxKnight wrote:
Thank you gentlemen. I’ve abandoned the last VI I had put together and kept the first one. For some reason I was thinking that I needed the two ‘Insert Into Array’ functions to input the data into the cluster, then to the arrays within the cluster. The initialization was at the beginning to reset the array, not necessarily required. I feel pretty dumb right now. I can see where I was going wrong now.
For the VI file, I was trying to avoid posting it: 1) I don't just want someone to do the work for me; give some guidance and let me figure it out. 2) I don't want someone to just copy my file and use it themselves.
But as always I have more questions now; if you guys could help answer them.
What is the idea behind adding dimensions to arrays? Say I wanted a 10x3 (column x row) array. Does the data populate from left to right, top to bottom? How would I feed data to an array that has multiple dimensions? Is there a way to control the data to these dimensions?
If I wanted to convert the data to string for the use in the table example, how would I convert it? Would I use the ‘Format into String’ function? How do I get the data to display on each column of the table? Is it the same as using the ‘Bundle’ function for the array? First connection is first column?
Sorry for the questions. I just want to understand.
*phew*, that was a lot of typing. I would suggest you watch some tutorials and experiment a bit to get more familiar with LabVIEW too.
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-23-2015 01:57 PM
Thank you, sir. I am very grateful for the time and effort you put into answering my questions. Your efforts won’t be in vain. I think this stuff is very interesting, and there is nothing more exciting than watching a program run that I created from scratch.
I often do a lot of research and watch a lot of tutorials before working on a program, but I learn best by doing. I often have too many questions during a tutorial.
Thank you again. I will use your feedback moving forward.