Operation on line on table with a For loop
Hello
I work with a wide range of dimensions column one. I'm doing the following
for i = 1:size (A) / 2
B (i, :) = A (1 + (i-1) * 2:i * 2))
So, for example if
A =.
0
1
2
3
4
5
6
7
then
B =
0 1
2 3
4 5
6 7
My approach was to use a subset of the table inside the loop for to select several items, but I don't know how to transpose the selected items in a new line to create the table (B) is there a simpler approach?
Thank you
Mike
try experimenting with the table to reshape feeding your table entry and re-sizing for a 2d aray of output. It is much faster to use a loop For, because the data is never moved and LV just changes the dimensions of the matrix and updates the stride.
Ben
Tags: NI Software
Similar Questions
-
Remove a line of table with a button in Livecycle Designer SS3
I have a table in Livecycle which includes 16 static lines. Several lines can be added or removed dynamically at the end of the table.
I want the user to be able to remove one of the static lines if they want to however I can't get the script to work.
I have a button at the end of the line with the script:
driverTable._Row2.removeInstance (true);
I tried various forms of this script such as do not use the abbreviation for 'instanceManager', leaving 'real' outside, etc. Where it says 'Row2' I would like to use this script for the following lines, Row3, etc. Row4.
I tried with the initial counter value of 1 and tried to zero. The table is in a fluid subform.
Can anyone help?
Hello
A line cannot be set to 0 cases, if you want to remove a line, you need to hide by using its property of presence...
But if you use 1 table for 16 different ranks, why don't you set the table with dynamic lines and have an initial 16 meter, then you can delete the lines you want with the removeInstance method
-
How to set a variable in a table to grid 'for' loop
I'm afraid I'm stuck again!
The next step in the animation I'm working on, is to set up a Boolean value, 'pierced = false', so that all instances of the attachMovie ("openCircle") have a Boolean "drilled = false' associated with them." Then when someone clicks on one of the instances of the attachMovie ("openCircle"), the Boolean value becomes "pierced = true', but only for that instance was clicked."
What I've done is to set the (Boolean) variable (highlighted in bold below) in the two 'for' loops through the table in the grid, but it returns an undefined value. Do I need to configure a separate table? (see code below):-
set up the grid for solid table
spacing: var number = 5.75;
Var CDL: number = 20; the number of columns in the grid
var rows: number = 20; number of grid lines
var leftMargin:Number = 154;
var topMargin:Number = 169;
depth: var number = 100; starting point for the depth
var drilled: Boolean;
for (i = 1; I < = lines; i ++) {}
for (j = 1; j < = cols; j ++) {}
drilled [rows, cols] = false;
trace (drilled);
current = attachMovie ("openCircle_mc", "openCircle_mc" + i + "_" + j, depth ++);
Current._x = leftMargin + ((i-1) * (spacing + current._width));
Current._y = topMargin + ((j-1) * (spacing + current._height));
Current.Row = i;
Current.Col = j;
Current.Oil = Math.floor (Math.random () * 1.1); about 1/10 objects have oil = 1, 9/10 oil = 0
Open the circle initially invisible, visible on rollover
Current._alpha = 0;
{current.onRelease = function ()}
trace (this.row + "" + this.col);
current.drilled = true;
}
current.onRollOver = function() {}
This ._alpha = 100;
}
current.onRollOut = function() {}
This ._alpha = 0;
}
}
}
I would be grateful for any help. Thank you.
Then, create a two dimension table named drilled so that it exists when you try to fill...
var drilled: Array = new Array (new Array();
There might be a problem that you're missing setting the values of the [0, #] components of the table - paintings begin with an index of 0.
-
Creating a table with a while loop
I want to create a table using a while loop but I don't know how to do it. Basically, I want to do the same thing as in the image of the example VI in LabVIEW VIs, called 'Graph XY Data Types.vi' example, but with a while loop instead of a for loop. The reason why I want to do with a while loop is because LabVIEW will not faint error or VISA data thanks to a for loop.
LabVIEW certainly enable you to pass out a mistake or VISA through a loop for. The default value is autoindex output and thus creating a table but is a simple right-click on the tunnel exit to change that. For recent versions, it changes the Tunnel mode to "last value". You can also use a shift register.
-
Capture of sequences of images - issues with nested for loops
Hi all
I've written a vi. to capture a number of images ("Image") and save these images, sent to a folder of my choice. Each image is identified sequentially. However, I would like to make a number of iterations ("run") of this capture sequence, such that each image file name would be "Filename (Run) _(Image_No).png", for example run 5, image 10 'Filename 5_10.png. I tried a nested for loop for this but I have an error message 'Current asynchronous i/o Operation' (I have attached a printscreen).
Can someone help me solve this problem? Please find attached my vi.
Sincere greetings and thanks,
Miika
Hi toto26,.
Thank you for your response. I solved the problem by using a sequence structure flat - file in the first image and all the treatment in the second.
Kind regards
Miika
-
Oracle Business Rule - Table of decision for loop
Hi Experts,
I have the scenario where I get the list of values, and I don't have to iterate over the values in the decision table. I can't use the normal return If so , in reason of the restriction of customer "only use table decision." Can someone guide me how to use the for loop in the decision table?
Thank you
We can check multiple values of the same element in the decision table. so no need to make a loop.
-
Hi all
I have a simple slider in my pl/sql procedure. I use the method for the slider of the loop and retrieve the values below.
DECLARE
VAR_A VARCHAR2 (100);
CURSOR C1 IS
SELECT DEPT_NAME, DEPT_NO OF THE DEPARTMENT;
BEGIN
FOR I IN C1
LOOP
VAR_A: = I.DEPT_NAME;
END LOOP;
-etc etc.
-etc etc.
EXCEPTION
WHILE OTHERS THEN
DBMS_OUTPUT. Put_line ('hello');
END
This workfine but if the DEPT table does not all records in it, it goes directly to the management of exceptions, and if there are all the other instructions after the FOR LOOP, they will not be executed. I know there is a method to use the cursor (instruction FETCH) more, but I want to know what is wrong by using the FOR LOOP.
The strange thing about this example is, even if I catch the exception, the program stops and if the DEPT table has no recording errors.
Any suggestions or tips are greatly appreciated.the program stops and if the DEPT table has no recording errors.
This seems a little suspicious. Probably another error product which is now hidden simply because of your manager WHEN of OTHER of exceptions, that didn't come out the real error message.
I recommend getting rid of the exception handler together and after the release of the thrown exception.
-
Add dynamic lines to Table with the new access property
Hi all
I have a scenario where:
1. I have a chart with lines including the readOnly property.
2. I want to dynamically add a new row to the table, and this new line should be writable.
3.I have added the following line in the click event of the button that adds a new line.
form1.Table1.Row1.access="";
But in the output line is added that is not writable.
If we add
form1.Table1.access = "";
then new line is added, but it changes the access of all to the writing table.
I want to change the access of the newly added line only and not the existing lines.
How can do us?
Thank you and best regards,
Nikhil
Hi Nikhil,
Please refer script below, it would be useful to you...
You must insert the script on the click event of the button below...
Form1. Page1.Table1.Row3.instanceManager.addInstance (true);
var countVal = (form1. Page1.Table1.Row3.instanceManager.Count - 1);
xfa.resolveNode ("form1. Page1.Table1.Row3 ["+ countVal +"]. TextField1") .access ="open ";
xfa.resolveNode ("form1. Page1.Table1.Row3 ["+ countVal +"]. TextField2") .access ="open ";
xfa.resolveNode ("form1. Page1.Table1.Row3 ["+ countVal +"]. TextField3') .access = "open";
This is what my table looks like.
If it does not please let me know vl share the file.
Thank you
Vijay
-
Create the table with aliases for columns
Hello
I don't know if its possible, but how do I define aliases for columns when I create a table (in fact, a global temporary Table - TWG)? The idea is to select the column using its name or its alias, like this:
SELECT nom_de_colonne FROM mytable
or
SELECT alias_de_colonne FROM MaTable
I work with Oracle9i Enterprise Edition Release 9.2.0.1.0
Thanks in advance.You do not define aliases when you create a table, when you choose him.
I have to say... When you use it in a SQL statement (not just select).
Published by: SomeoneElse 18 Sep, 2008 15:10
-
Activation of channels with a for loop
So basically, I try to select each one of my channels in the order and a complete set of tasks on each. I want to be able to specify which channels are ACTED, so I already have a picture of my selected channels, but when I try to run the loop, it is said that "activeChannels =" needs a picture.
I know that my table of channelNumber is good, but I can't figure out how to make this loop to work.
Here's my loop for:
for (var i = 0; i < channelNumber.length; i ++) {}
doc.activeChannels = channelNumber [i];
do stuff
}
I actually just thought of it. When I declared my channelNumber variable I just declare "channelNumber = new Array (doc.activeChannels)" instead of "= doc.activeChannels channelNumber" and it worked fine. Seems silly not to accept a single channel.
-
Problems with nested for loops - save images from a camera
Dear Norbert_B,
Thank you for your response. I solved the problem by using a sequence structure flat - file in the first image and all the treatment in the second! Easy as pi!
Kind regards
Miika
-
trouble with inner for loop in my procedure values
Hello...
I use oracle 10g and this is my procedure...
create or replace procedure sales_information is
v_qty number (10);
Number of rem_qty (10): = 0;
cursor pck_quantity is
Select * from sales_info;
cursor no_of_labels is
Select ceil (sum (nvl (total_quantity, actual_quantity)) / 400) in the sales_info;
Start
no_of_labels j
loop
because me in pck_quantity
loop
Select nvl (i.total_quantity, i.actual_quantity) in the v_qty of sales_info;
If v_qty > = i.packed_quantity and rem_qty = 0 then
Insert values sales_order-
REM-quantity: = v_qty - i.packed_quantity;
v_qty: = rem_qty;
"exit";
otherwise if v_qty > = i.packed_quantity and rem_qty > = 400 then
Insert values sales_order-
rem_qty: = v_qty-rem_qty;
v_qty: = rem_qty;
"exit";
otherwise if v_qty > = i.packed_quantity and rem_qty > 0 then
rem_qty: = v_qty + rem_qty - i.packed_quantity;
v_qty: = rem_qty;
Insert values sales_order-
Otherwise, if v_qty is null and rem_qty > 0 then
Insert values sales_order-
otherwise if v_qty < i.packed_quantity and rem_qty: = 0 then
rem_qty: = v_qty;
otherwise if v_qty < i.packed_quantity and rem_qty > 0 then
If (v_qty + rem_qty) > 400 then
Insert values sales_order-
rem_qty: = v_qty + rem_qty - i.packed_quantity;
v_qty: = rem_qty;
end if;
end if;
end loop;
end loop;
Inside of the loop will retrieve values of v_qty for each iteration of the loop outside when he runs the only select the following:
Select nvl (i.total_quantity, i.actual_quantity) in the v_qty of sales_info;
and therefore loses the previously calculated values of v_qty and rem_qty
in the previous iteration of the loop outside whereas I want inside the loop iterate on it previously calculated the values of v_qty and rem_qty but can not think of a work around.
-
Hello
I don't have any experience with parallel for loops, so I need your help.
Goal: To do a calculation (average, average) on the rows (or columns) table 2D as quickly as possible. The calculations are independent of each other and I would get a table 1 d with the results.
I read a few posts on parallel for loops and I would like to find an example for my trivial problem, but I can't.
Could you help me, it is possible is improve it the effectiveness of the calculation on lines with parallelism in LabVIEW? and it is, could you post an example how to do?
Thank you
If the speed issues, do not write your own "average." First of all, it already is in the range of statistics, but then you must be inline your average VI or do the calculation explicitly (as shown below). the size of the array never changes for the duration of the loop, it seems redundant to get the size of the array on each iteration.
Here's what you could do.
On my bench, it's much faster than the use of 'mean.vi' of the palette. Average a overhead, Subvi (1) (2) needs to get N with each call and (3) is also an unnecessary error checking.
(Sorry, I have 32 processors, so the number of instances is set a little high. Modify if needed).
-
Indexing of a table with multiple indexes
Hi all
I just used the detector of Ridge VI on table 1 d with a threshold. I now have an array of index I need to round to use as a real index. My question is, with this index corresponding to the points picture, how, I take the peak values
To give a bit of context:
1. I have three time correlated signals. I filter them, normalize, then add them so that I can increase the signal-to-noise ratio.
2 pic DetectionVI gives me a table where are these pics
3. I want my end result
A. Signal1 [peak_indices]
B. Signal2 [peak_indices]
C.Signal3 [peak_indices]
Now I think about it in the way I have d code in MATLAB which is much easier, but I would like to do this in Labview and would be very happy to any idea.
Thank you
-Joe
As you said, once you have rounded tip to the nearest value locations you have an array of markings. From there on, it should be a simple matter of passing this table in a for loop that auto-index of the results that you went out to generate a table of peak values.
-
CURSOR for loops or an associative array
I just want to know the advantages and disadvantages of the CURSOR for loops. As a general rule, what guys do you prefer: associative array with CURSOR for loops?
If you use the CURSOR for loop, is it not difficult to debug?
PL/SQL Developer, I do not see what values are stored in the CURSOR for loop (in SP master_proc below) as
There are no variables to watch. Not sure if the TOAD can show these values
If I had used an associative array (master_proc2 below), I can see the values stored in the table by clicking on "show Collection"variable in PL/SQL developer.
create table emp2 as select * from emp; create or replace procedure my_proc(p_empno in number) as begin update emp2 set sal=sal+100 where empno=p_empno; end; / --Using CURSOR FOR loop create or replace procedure master_proc as begin for rec in (select empno from emp2 where empno>7700) loop my_proc (rec.empno); end loop; end; / -- Using Associative arrays create or replace procedure master_proc2 as type v_empno_type is table of number index by pls_integer; v_empno v_empno_type; begin select empno bulk collect into v_empno from emp2 where empno>7700; for i in 1..v_empno.count loop my_proc (v_empno(i)); end loop; end; /
VitaminD wrote:
Thank you Tubby. If you are faced with a situation where you MUST use a loop. Then you would go to associative arrays rather than CURSOR FOR loops. Right?Doesn't happen too often, but if/when then I would do as I said in my first post. Use the transformation, the collection table in BULK and FORALLs.
If we use your example posted, I would NOT spend a single table (in a loop mode) value I would be transmitted in the OVERALL picture and treat it with FORALL.
So, I would still use neither of the approaches that you mentioned.
Maybe you are looking for
-
Installation of Bootcamp Windows 10
Greetings, I have a new 2015 end 5 k in 27 imac. Try installing Windows 10 via bootcamp. I bought a copy of windows version full House 10 usb. then followed the instructions on using 10 Windows on your Mac with Boot Camp - Apple Support and downloa
-
I lost the recovery CD - where I can get it?
I lost my Toshiba Recovery dvd - rom pc's anyway to get it back?
-
I don't know if this question has been asked, I gave a glance to the community to see if they have the specific answer, I need which is: the switch must a router works properly or it can function without it to connect several devices to the internet
-
My pc does not recognize that my Sony TV as generic monitor...
So, I got this desktop of a parent computer and everything worked at the time, his and all. But it was always filled with things I didn't want to uninstall, so I decided to reset it using the Rcovery system tool (via: start > F11 > System Recovery...
-
Vista Service Pack 1 update fails - computer will not start and cannot be repaired
The computer which is an Acer desktop computer, running Windows Vista Premium. In the last 6 months updated Vista tried Service Pack 1 update to install Vista about 8 times and failed every time a reason any. Just before this latest incident, a fac