Arrays to 3D-cluster arrays input Feed into draw Mesh
Hi,
I'm puzzzle with my own algorithm.
I want to grab input then feed into 3D-cluster array . then feed into Mesh parameters array.
The problem i had, I want to take 2 rows, feed into 3D-cluster, then send into mesh parameter,
then redo it with another 2 rows moving down the array.
So i will have 1 line that "move" in the 3D picture control
Attached is my vi.
Attachments:
array-problem.JPG 72 KB
Sorry here the VI ..
Attachments:
moving3D-data work3.vi 18 KB
zulhairi_1.csv 71 KB
Similar Messages
-
Hello,
in my vi I have a chart with 5 Plots displaying measurement data.
The user should be able to save all the history data from the chart at anytime. (e.g. the user watches the chart and some event happens, then he presses a "save"-button)
I know, that I can read out the history data with a property node. That is not the problem. The problem is, how do I handle the data? The type of the history data is a 1-D array of cluster of 5 elements.
I have to convert that data somehow into a 2 D-array of numbers or strings, so that I can easily save it in a text-file.
How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers?
I use LabVIEW 7.1
Johannes
Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
Solved!
Go to Solution.Gerd,
thank you for the quick response and the easy solution.
Look what I did in the meantime. I solved the problem too, but muuuch more complicate :-)
And I have converted the numbers to strings, so that I can easily write them into a spreasheet file.
Johannes
Message Edited by johanneshoer on 04-28-2009 10:39 AM
Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
Attachments:
SaveChartHistory.JPG 57 KB
SaveChartHistory.JPG 57 KB -
Unable to plot 1-D array with a cluster of 2 elements on an XY graph
I'm Unable to plot a 1-D array with a cluster of 2 elements on an XY graph. The data appears at the input to the graph but nothing is plotted. I'm trying to plot a line connecting each point generated.
Solved!
Go to Solution.
Attachments:
TEST11.vi 13 KBChuck,
0. Do not post VIs with infinite loops! Change the True constant to a control. One of the regular participants on these Forums has commented that using the Abort button to stop a VI is like using a tree to stop a car. It works, but may have undesired consequences!
1. Use a shift register on the For loop also.
2. Inserting into an empty array leaves you with an empty array. Initialize the array outside the loop to a size greater or equal to the maximum size you will be using. Then use Replace Array Subest inside the loop.
3. Just make an array of the cluster of points. No need for the extra cluster.
Lynn
Attachments:
TEST11.2.vi 11 KB -
How to build a cluster array dynamically from another cluster array?
I'm working on a problem where I seem to be getting lost in a sea of
possibilities, none of which strikes me as optimum. Here's what I need to do.
I've got an input array of clusters (ARR1). Each cluster contains the
following components: an integer (INT1), a ring variable (RING1), a boolean
(BOOL1) and a cluster which itself is simply a bunch of ring variables
(CLUST1) Now, I need to transform that into a set of clusters (CLUST3) each of
which contains an array of characters (CHARARY2), a copy of the ring variable
(RING2), a copy of the boolean variable (BOOL2) and a copy of the cluster
(CLUST2).
To build the CLUST3, I need to find all elements within ARR1 that have the
same unique combination of RING1 and BOOL1, and if BOOL1 is True, then RING1
in addition, build an array of all the INT1 values corresponding to each
unique combination above converted to character, and then bundle this array
plus the unique combination of the other variables into a new cluster. In
general I could have several such clusters.
So if I had the following array to start with:
Index INT1 RING1 BOOL1 CLUST1
0 3 1 F {Values1}
1 2 1 T {Values2}
2 4 0 F {Values1}
3 6 0 F {Values3}
4 1 2 T {Values2}
5 4 2 T {Values2}
6 3 0 T {Values3}
7 4 2 T {Values3}
I should end up with the following clusters:
CHARARY2 RING2 BOOL1 CLUST1
"3" 1 F Don't care
"2" 1 T {Values2}
"4","6" 0 F Don't care
"1","4" 2 T {Values2}
"3" 0 T {Values3}
"4" 2 T {Values3}
What methods would you suggest for accomplishing this easily and efficiently?
Alex Rast
[email protected]
[email protected]Tedious but not conceptually difficult.
ARR1 goes into a for loop, auto indexed on the FOR loop. The for loop has a
shift register which will be used to build the output array. Nested within
the for loop is another for loop, which the shift register array goes into,
again auto indexed, along with the element that has been auto-indexed from
ARR1. This for loop has a shift register, initialised with a boolean "true".
The inner loop compares the current element of ARR1 with the output array
and if an element in the output array is already present which matches the
input by your criteria, then the boolean register is set false; otherwise it
is left alone.
After the nested FOR loop you have a case fed from the boolean shift
register; if the boolean is true, the new element is unique and should be
added to the array. If it is false then a previous element has been found
making the present one redundant, and the array should be passed through
without adding the element.
In the true case, you simply unbundle the original element into its
components and build the new element, using "build array".
Notes for if the above is easy for you;
1) if handling lots of data then pre-initialise the shift register of your
outer loop with the same number of elements as your input array. Use
"Replace Array Subset" instead of "Build Array" to insert the current
element into the pre-allocated memory rather than having to create a new
array and copy all the current data across, which is what "Build Array" is
doing. Use "Array Subset" at the end to obtain a new array containing just
the elements you've used, removing the unused ones at the end.
2) Again for large datasets- the use of a while loop instead of the inner
for loop is more efficient since you can halt the while loop as soon as a
duplicate is found. With the described approach you have to go through the
whole array even if the first element turns out to be a duplicate- much
wasted computer time.
Alex Rast wrote in message
news:[email protected]...
> I'm working on a problem where I seem to be getting lost in a sea of
> possibilities, none of which strikes me as optimum. Here's what I need to
do.
>
> I've got an input array of clusters (ARR1). Each cluster contains the
> following components: an integer (INT1), a ring variable (RING1), a
boolean
> (BOOL1) and a cluster which itself is simply a bunch of ring variables
> (CLUST1) Now, I need to transform that into a set of clusters (CLUST3)
each of
> which contains an array of characters (CHARARY2), a copy of the ring
variable
> (RING2), a copy of the boolean variable (BOOL2) and a copy of the cluster
> (CLUST2).
>
> To build the CLUST3, I need to find all elements within ARR1 that have the
> same unique combination of RING1 and BOOL1, and if BOOL1 is True, then
RING1
> in addition, build an array of all the INT1 values corresponding to each
> unique combination above converted to character, and then bundle this
array
> plus the unique combination of the other variables into a new cluster. In
> general I could have several such clusters.
>
> So if I had the following array to start with:
>
> Index INT1 RING1 BOOL1 CLUST1
> ---------------------------------------------------
> 0 3 1 F {Values1}
> 1 2 1 T {Values2}
> 2 4 0 F {Values1}
> 3 6 0 F {Values3}
> 4 1 2 T {Values2}
> 5 4 2 T {Values2}
> 6 3 0 T {Values3}
> 7 4 2 T {Values3}
>
> I should end up with the following clusters:
>
> CHARARY2 RING2 BOOL1 CLUST1
> -----------------------------------------------------
> "3" 1 F Don't care
> "2" 1 T {Values2}
> "4","6" 0 F Don't care
> "1","4" 2 T {Values2}
> "3" 0 T {Values3}
> "4" 2 T {Values3}
>
> What methods would you suggest for accomplishing this easily and
efficiently?
>
> Alex Rast
> [email protected]
> [email protected] -
Scrollable cluster arrays as control, writing programmatically at the same time?
I would like to have a cluster array (just an example, you may suggest better solution), where each row (cluster-element) contains signal selection from combobox, and its value and unit.
I would like to have a signal list, where in each row, I can select which signal I want to show e.g. "motor speed", "motor torque", "motor power". And when signals are selected, the value of the
signals are automatically updated elsewhere. So basicly, I want to select which signals I monitor, and then watch them change over time. I use single cluster array because I want it to be scrollable. The problem is:
* let's say I have one row in the array. Then I add a row by editing the control in the GUI (now the array control has size 2).
* I have property node (write: array control -> value) to update the values and units in my software.
* I use array control output as the input in the subVI where I read my selections and write updated signal values.
* It can happen that I use that array control output when it still has size 1, and while I have added the second element, the software updates the control, and overwrites my new element addition.
So, I run into writing conflict. Only single user, just this problem. How should I avoid this?
(e.g. how can I know that user is not interacting with the control, so that I can update its value and unit fields)First suggestion is to post the code you have.
But that being said what you want to do can be done. I think the problem you are having is a race condition between the user and the software. Where the user chagnes the value and the software changes it back. I suggest reading the value of the control and replacing its value but keep the signal names the user entered, then write that back to the control.
Another suggestion is to have two separate arrays, one that is signal selection, and one is values. Then you only need to update the values table with the new data and the signal names never get overwritten. You'll likely want to couple the two arrays so when one index value changes the other changes with it. This can be done with an independent scrollbar control.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously. -
Trying to replace an array in a cluster
I have a 1-D array of a type definition with a cluster of 5 elements. One of the elements is an array that I want to replace. Can anyone help me understand how to do that?
Thank you.
Solved!
Go to Solution.
Attachments:
CMM_Set_SN.vi 20 KBYou're missing a lot of VI's and controls. So it is difficult to tell exactly what you are doing.
Are you getting an error? I see an error due to mismatched datatypes where you are trying to feed an array of strings into an array of U8's.
You are also going through a song and dance of converting your 1-D array of clusters into a cluster, then later converting that cluster back into an array.
You need to index out an element of your 1-D array of clusters, replace the cluster element that is a 1-D array of U8's with another 1-D array of U8's using the bundle by name, then use the replace array subset to get that element back into your array.
Are you sure you really need as complicated of a data structure as your are trying to use?
Message Edited by Ravens Fan on 03-27-2010 10:27 PM -
I have a page for entering/editing the data for a table of
contacts, and would like to be
able to compare the data for two different entries.
Conceptually the simplest way to do
this would be to load two identical copies of the same page,
and have each copy return its
results in a separate sub array in the $_POST array.
For example I have an input which returns a value
$_POST['address']. Is there any simple
way whereby I could instruct this input to return
$_POST['entry_1']['address'] in the
first copy, and $_POST['entry_2']['address'] in the second
copy?
A similar question relates to fields which have sub entries.
At present I encode these
into the name of the return value (for example 'al1' in the
case below), and have to
decode them before I can put the results into the right box,
but it would make things much
simpler -- and therefore easier to understand and less error
prone -- if I could return
$_POST['address']['line_1'] and so on directly.On Sat, 21 Feb 2009 12:57:27 +0000 (UTC), Joe Makowiec
<[email protected]> wrote:
>On 20 Feb 2009 in macromedia.dreamweaver, Clancy wrote:
>
>> I have a page for entering/editing the data for a
table of contacts,
>> and would like to be able to compare the data for
two different
>> entries. Conceptually the simplest way to do this
would be to load
>> two identical copies of the same page, and have each
copy return its
>> results in a separate sub array in the $_POST array.
>>
>> For example I have an input which returns a value
$_POST['address'].
>> Is there any simple way whereby I could instruct
this input to
>> return $_POST['entry_1']['address'] in the first
copy, and
>> $_POST['entry_2']['address'] in the second copy?
>>
>> A similar question relates to fields which have sub
entries. At
>> present I encode these into the name of the return
value (for
>> example 'al1' in the case below), and have to decode
them before I
>> can put the results into the right box, but it would
make things
>> much simpler -- and therefore easier to understand
and less error
>> prone -- if I could return
$_POST['address']['line_1'] and so on
>> directly.
>
>You can sort of do this by adding square brackets [] to
the name
>attribute of several identically-named input fields:
>
><form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']; ?>">
> <p><label
for="streetAddress">Street</label>
> <input type="text" name="address[]"
id="streetAddress"></p>
> <p><label
for="apartment">Apartment</label>
> <input type="text" name="address[]"
id="apartment"></p>
> <p><input type="submit" name="button"
id="button" value="Submit"></p>
></form>
><?php
>if ($_SERVER['REQUEST_METHOD'] == 'POST') {
> echo "<p>Post array:</p>\n";
> echo "<pre>\n";
> print_r($_POST);
> echo "</pre>\n";
>}
>?>
>
>What gets returned is $_POST['address'][], where the
second index
>ranges between 0 and the number of same-named input
fields less 1.
>In the code above, 'apartment' would be addressed as
>$_POST['address'][1].
Thanks, Joe,
This is interesting, but not really what I was looking for.
It might be helpful for
entering the results from one page, but it doesn't really
help in separating the outputs
from two copies of the same page. I suppose, though, I could
count the number of (say)
'address' responses, and divide by the number of identical
pages. Then I would know at
terms 0 to 3 belong to the first page, and 4 to 7 to the
second -- provided I always had
the same number of items on each copy of the page, which
ain't necessarily so!
However I doubt whether this is any simpler than the
alternative of encoding the page
number into the name of the variable. -
How to create an array of a cluster?
Hello!
Now we need some help or tip again :-) We have an array of strings coming out from a for-loop. We want to pick this array in peaces and get the string-elements out. These elements we want to get into a cluster together with boolean constant. Of this cluster we then want to create an array. The problem is that we do not know how to overcome the trouble with data-types and for-loopes... *scratching our head...* Anyone? Thank youHello Ex-jobb,
have a look at my example. I included a second way to build your array of cluster.
The string generation at the left of the diagram is to simulate your text file reading, it also gives you an array of strings.
This array is in the upper part converted by using autoindexing of an for-loop. In the lower part I used just an "Index Array" with
"Build cluster" and "build array".
Hope this helps,
GerdW
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
ArrayOfCluster.vi 29 KB -
Programmatically create array from common cluster items inside array of clusters
I have seen many questions and responses on dealing with arrays of clusters, but none that discuss quite what I am looking for. I am trying to programmatically create an array from common cluster items inside array of clusters. I have a working solution but looking for a cleaner approach. I have an array of clusters representing channels of data. Each cluster contains a mixture of control data types, i.e.. names, types, range, values, units, etc. The entire cluster is a typedef made up of other typedefs such as the type, range and units and native controls like numeric and boolean. One array is a “block” or module. One cluster is a channel of data. I wrote a small vi to extract all the data with the same units and “pipe” them into another array so that I can process all the data from all the channels of the same units together. It consists of a loop to iterate through the array, in which there is an unbundle by name and a case structure with a case for each unit. Within a specific case, there is a build array for that unit and all the other non-relevant shift registers pass through. As you can see from the attached snapshots, the effort to add an additional unit grows as each non-relevant case must be wired through. It is important to note that there is no default case. My question: Is there a cleaner, more efficient and elegant way to do this?
Thanks in advance!
Solved!
Go to Solution.
Attachments:
NI_Chan units to array_1.png 35 KB
NI_Chan units to array_2.png 50 KBnathand wrote:
Your comments made me curious, so I put together a quick test. Maybe there's an error in the code (below as a snippet, and attached as a VI) or maybe it's been fixed in LabVIEW 2013, but I'm consistently getting faster times from the IPE (2-3 ms versus 5-6ms for unbundle/index). See if you get the same results. For fun I flipped the order of the test and got the same results (this is why the snippet and the VI execute the tests in opposite order).
This seems like a poster child for using the IPES! We can look at the index array + replace subset and recognize that it is in place, but the compiler is not so clever (yet!). The bundle/unbundle is a well-known "magic pattern" so it should be roughly equivalent to the IPES, with a tiny penalty due to overhead.
Replace only the array operation with an IPES and leave the bundle/unbundle alone and I wager the times will be roughly the same as using the nested IPES. Maybe even a slight lean toward the magic pattern now if I recall correctly.
If you instantly recognize all combinations which the compiler will optimize and not optimize, or you want to exhaustively benchmark all of your code then pick and choose between the two to avoid the slight overhead. Otherwise I think the IPES looks better, at best works MUCH better, and at worst works ever-so-slightly worse. And as a not-so-gentle reminder to all: if you really care about performance at this level of detail: TURN OFF DEBUGGING! -
Read / write cluster array?
Hi NG,
is there an easy way to read and write an array of clusters? I've found
neither anything like that in my literature nor in the internet.
I't would be great if someone could help me!
Greetings
FlorianHi,
you must use "Read File.vi" and "Write File.vi" to read/write array of clusters to the file.
When you write data to the file, you just need to wire your array to "data" input node of "Write File.vi". Also you may wire TRUE to "header" input of this VI. The header with array sizes will be added to the file so you will be able to read array back as an array, not as elements. Read help about this.
When you read data from the file, you need to wire the array of cluster constant to "byte stream type" input of "Read File.vi" to specify the type of data which will be read from file.
Also there are some examples in LabVIEW which could help you. Go to menu "Help->Examples...->Fundamentals->File I/O->Datalog File Examples"
Good luck.
Oleg Chutko. -
Hmi wizard for indicators inside cluster array
I am setting up a config screen for use with the DSC and tag engine. I have an indicator and analog value inside a cluster array. Can you use the hmi wizard to make unique conditions for the indicator in each array element?? or would I have to use a sub vi to write the values to the elements inside the clusters??
Attachments:
TOOLPASS_CHANNEL_CONFIG_DATA.vi 17 KBHi,
The simple control in the cluster or in an array will not have a way to invoke the HMI Wizard to create simple HMI code because the control turns into a more complicated control type. Using a sub vi to unbundle the cluster should be a workaround for this application.
Regards,
Remzi A. -
Cluster array to c structure in DLL
Hello,
I have a problem which I am stuck at so I would really appreciate any help.
I have this function that i need to access in Labview.
ViStatus _VI_FUNC Ki_GetSystemInfo (ViSession instrumentHandle,
void *systemInfo);
Now the structure for systeminfo is as follows:
typedef struct _SYSTEM_INFO
char pchModelNum[MODEL_NUM_LEN];
char pchSerialNum[SERIAL_NUM_LEN];
char pchSysSoftwareVer[SOFTVER_LEN];
char pchPlatformVer[PLATVER_LEN];
char pchOpSystemVer[SYSTVER_LEN];
int bCardType[MAX_SLOTS]; // Enum slot_types
} systeminfo;
When i use the call Library Node function to access the above function what
should be mine
input and out paramteres. I tries making cluster of 5 st
rings and an array
of integers
It doesnt seem to work. Any help shall be appreciated.
PremalHi Premal,
Try to use arrays of [U8] instead of strings. Also, pay attention to INT - is OS dependent (assuming that you are using win9x/NT/2000, use [I32]). If you try with strings, be sure that the input string contains enough characters to store the result.
Hope this helps
p.s.: take a look on those articles mentioned in "cluster array to c structure in DLL" [http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=137&HOID=506500000005000000C05C0000&HTHREAD=000023744&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0] -
Scripting: Create Cluster in Array from existing cluster
I am creating a custom programming tool to generate some custom LabVIEW TypeDefs.
One of the structures I have to create is an array of clusters; but from an existing cluster. That is, I have a reference to a previously defined cluster, and I need to array this.
One possible way to do this is to duplicate the cluster next to the empty array, and then 'move it into' the array. This seems to be an ugly solution.
Is there a better way? When I try and use "Create from Reference" method, the cluster is created in the array, but the sub-elements trigger error 0x421: Type Mismatch.
Thanks!
JedHi Viper,
Sorry- you misunderstand. We are talking about doing this with LV Scripting; what you did statically defines the array type in the VI. Writing LV code that would create the array from an undefined array by running a VI. (In the situation above, the code would actually EDIT the VI and change it's functionality)
There are a few examples in the distro if you search for "scripting", but here's a page with some example code you can look at.
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/wiring_scripting_objects/ -
How can i get the time and result together show in one Array or in Cluster?
hello everyone i am a new user .I want to get the time and voltge form a Generater. How can i get the time and result together show in one Array or in Cluster?When i selecte the first(or third...) result then in the front panel display the time and the voltge.Thank you!
I post the time and voltge NOT together photo
Attachments:
12345.GIF 54 KBYou can create an array of clusters with one element being the time and the other being the voltage, like so (using the "Get Waveform Components" function):
Message Edited by smercurio_fc on 10-17-2007 03:15 PM
Attachments:
pic.PNG 11 KB -
Address element of only one line in cluster array
Hi,
I created an array of clusters. In each cluster the switching a binary element is supposed to activate/deativate the following elements. In my VI however either the elements of none or the elements of all clusters are activated/deactivated. Does anybody see, where I made the mistake?
Thank you.
Attachments:
ClusterArray.vi 21 KBHallo,
in einem cluster-array können nur die Werte individuell verstellt werden. Eigenschaften gelten immer für alle Array-Elemente. Diese Frage wurde schon im ni-forum diskutiert, z.B. um LED-Farben einzustellen:
http://forums.ni.com/ni/board/message?board.id=170&message.id=27375&query.id=12471#M27375
In deinem Fall hilft das aber nicht weiter, da ich nicht wüsste wie über ein Wert die Sichtbarkeit des Elements eingestellt werden kann.
Noch eine Bemerkung am Rand: die For-Schleife benötigt in deinem Beispiel keinen Zähleingang, bei indizierten Array-Eingängen wird die FOR-Schleife genau einmal für jedes Array-Element durchlaufen.
Vielleicht kann ja doch noch jemand weiterhelfen
Gruß,
Magnus
Maybe you are looking for
-
My ipod doesn't update in itunes. When i try updating it, the message "Songs on the ipod (said ipod) cannot be updated because all of the playlists selected for updating no longer exist". When i try to manually manage the songs on my ipod, i put the
-
Problems using DBMS_PIPE package
Hi! Im using the SQL Navigator for Oracle to develop PL/SQL code and now I've got a problem with the DBMS_PIPE package. When i use the methods like create_pipe etc. in a normal pl/sql window it works without problems. But when i place such a DBMS_PIP
-
Running firefox on Windows Vista home version.
-
Stationery Template - appearance breaks when recipient opens
I've tested several Mail Stationery Templates. They seem to break their formating when I send them to non Mac users (my mother). When I send a test email to myself it looks fine. Any solutions or suggestions? Wish I could attach my mom's reply to sho
-
I am having problems printing from my iPad via my AirPort Extreme network.
I am having no success printing from my iPad via my AirPort Extreme based local network. I can use this to print wirelessly from my iMac OS X 10.7.5 and MacBook Pro OS X 10.6.8. I have 2 printer options: HP Laserjet (B&W) P1005 hard-wired to the iMac