Display text in label from 'for loop'
Hi
I'm new to Java, in fact so new just started yesterday.
I'm trying to display all the values from a for loop into a label control in my application.
Problem is, its only displaying the last number. Can anyone please help.
Thanks
George
--------------------------------------------Code----------------------------------------------
int lottoNumbers1 = Integer.parseInt(txtLotteryNumbers1.getText());
int lottoNumbers2 = Integer.parseInt(txtLotteryNumbers2.getText());
int lottoNumbers3 = Integer.parseInt(txtLotteryNumbers3.getText());
int lottoNumbers4 = Integer.parseInt(txtLotteryNumbers4.getText());
int lottoNumbers5 = Integer.parseInt(txtLotteryNumbers5.getText());
//int lottoNumbers6 = Integer.parseInt(txtLotteryNumbers6.getText());
int arrUserInput[] = {lottoNumbers1, lottoNumbers2, lottoNumbers3, lottoNumbers4, lottoNumbers5};
int arrRnd[] = new int[5];
Random rnd = new Random();
for (int i = 0; i < arrRnd.length; i++) {
arrRnd[i] = rnd.nextInt(49);
boolean isfound = false;
for (int i = 0; i < arrUserInput.length; i++) {
isfound = false;
for (int j = 0; j < arrRnd.length; j++) {
if (arrUserInput[i] == arrRnd[j]) {
isfound = true;
if (isfound) {
//System.out.println("Same Numbers again : " +arrUserInput[i]);
String numbers = Integer.toString(arrUserInput[i]);
int res = NumberCount.wordcount(numbers);
//System.out.println("Number of matches : " +res);
switch (res) {
case 1:
lblNumbersEntered.setText("You matched 1 number " + arrUserInput[i] + " and win nothing");
System.out.println("Number of matches : " +res);
break;
case 2:
lblNumbersEntered.setText("You matched 2 number " + arrUserInput[i] + " and win £2");
System.out.println("Number of matches : " +res);
break;
case 3:
lblNumbersEntered.setText("You matched 3 number " + arrUserInput[i] + " and win £10");
System.out.println("Number of matches : " +res);
break;
case 4:
lblNumbersEntered.setText("You matched 4 number " + arrUserInput[i] + " and win £50");
System.out.println("Number of matches : " +res);
break;
case 5:
lblNumbersEntered.setText("You matched 5 number " + arrUserInput[i] + " and £1000");
System.out.println("Number of matches : " +res);
break;
default:
lblNumbersEntered.setText("You have matched no numbers");
System.out.println("Number of matches : " +res);
break;
If you want a complete history of each time you go through the loop, you have to construct the history:
[code]
myLabel.setText("This");
MyLabel.setText(" is");
myLabel.setText(" good");
[/code]
myLabel will contain only " good", since that is what myLabel was set to last, but if you want the history:
[code]
myLabel.setText("This");
MyLabel.setText(myLabel.getText() + " is");
myLabel.setText(myLabel.getText() + " good");
[code]
Should give you "This is good", as each time the contents of myLabel are retrieved and appended before myLabel is given the new set value.
Similar Messages
-
Display a message in a For Loop with field value
Hello All,
pls,i wanna display a message in a For Loop with field value the code is:
FOR Q1 IN GET_SUM_EXP_QUANTITY LOOP .
INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
(FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
VALUES (:PLN_PLAN.FIN_YEAR_CODE , TO_CHAR(V_FROM_DATE,'MM') , Q1.MATERIAL_CODE , 1 , V_MONTHLY_QTY , Q1.GROUP_CODE);
MESSAGE(':PLN_PLAN.FIN_YEAR_CODE'||:PLN_PLAN.FIN_YEAR_CODE ||' '||'V_FROM_DATE = '||TO_CHAR(V_FROM_DATE,'MM'), 'Q1.MATERIAL_CODE'||' '|| Q1.MATERIAL_CODE||' '||'DISTRIBUTION_WAY'||' = 1'||'EXPECTED_QUANTITY'||' = '|| V_MONTHLY_QTY||'GROUP_CODE'|| ' '|| Q1.GROUP_CODE);
FORMS_DDL('COMMIT');
How 2 display a message with the value:
Q1.MATERIAL_CODE
Q1.GROUP_CODE
message(Q1.MATERIAL_CODE)
gave me numeric or value error on run time when pressed on button
Regards,
Abdetu..Thanks 4 reply..
again they r in a For Loop as mentioned above...
INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
(FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
VALUES (:PLN_PLAN.FIN_YEAR_CODE , V_REPAIR_MONTH , Q1.MATERIAL_CODE , 1 , V_REPAIR_Qty , Q1.GROUP_CODE);
FORMS_DDL('COMMIT');
The fields in bold r required to be displayed for testing puposes..
this gives me numeric or value error in runtime..
Best regards,
Abdetu.. -
hello,
I have a problem with one of my applications I am developing.
I calculate a timeSeries and I need to graph it on linechart. The timeSeries is calculated through an iteration of For Loop
I have tried to write in an array, but it didn't work since I can only take one value.
I tried to write the value in a datagrid but that didn't work either!
not because it is impossible, but because I am an idiot
http://alimsyed.comHi Dimitris,
Thanks for the post and I hope your well today.
You can achieve this by using a reference of the graph from the main VI, pass it to the subVI vi and use a property node to update the graphs value.
I have attached an edit of your code to show this, labVIEW 8.6.
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help!
Attachments:
mainVI.vi 9 KB
subVI.vi 13 KB -
Is it possible possible to exist from FOR loop while executing
Hi
Like break in C, is it any method available in LabVIEW to exist from a FOR LOOP while executing.
thanks in advanceNo. You have to use a while loop.
-
Pick up specific indices from for loop
hi guys ,
i have a for loop with N = 60 , i'm trying to make something when the index (i) reachs specific number , the indecies i'm interested in are
1 ,5 , 9,13, 17, 22, 26, ,30,34,38,43,47,51,55,59
the difference is 4 in some of them but it changes to 5 @ 22 and 43 and come back to 4 in between .
can anybody help me pick up these indecies ?
Solved!
Go to Solution.Why would you need a mathematical formula?
What is a "boolean variable"? In the context of LabVIEW, you need to explain in more detains what you mean )
I would just do something similar to the following (The second loop will iterate 60 times):
Note that the parts on the left will be folded into a single boolean array constant at compile time, so there is no overhead during execution.
(You can also do it all in a single loop. try it. )
LabVIEW Champion . Do more with less code and in less time .
Attachments:
IrregularSelection.png 16 KB -
Here i drew connect four board game which has 6 row and 7 columns . There is an additional row appear . How can i out from loop to not draw seven rows. ??
import java.awt.Dimension;
import javax.swing.JFrame;
public class TestNet extends JFrame {
private DrawingNet drawingNet;
public TestNet() {
drawingNet = new DrawingNet();
getContentPane().add(drawingNet);
public static void main(String[] args) {
TestNet testNet = new TestNet();
testNet.setDefaultCloseOperation(TestNet.EXIT_ON_CLOSE);
testNet.setSize(new Dimension(600, 300));
testNet.setLocationRelativeTo(null);
testNet.setVisible(true);
testNet.setExtendedState(MAXIMIZED_BOTH);
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
class DrawingNet extends JPanel {
private int X_START = 100, Y_START = 100, DISTANCE = 0;
private static final int ROW = 6, COL = 7;
// private final int[][] arrayNet;
public DrawingNet() {
// arrayNet = new int[ROW][COL];
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.BLACK);
for (int c = 0; c < COL; c++) {
// if (c ==7 ) {
// break;
for (int r = 0; r < ROW; r++) {
// if (r == 5) {
// break;
g.drawLine(X_START, Y_START + DISTANCE, X_START * COL, Y_START + DISTANCE);
g.drawLine(X_START + DISTANCE, Y_START, X_START + DISTANCE, Y_START * ROW);
DISTANCE += 100;
}Thanksif you compile my code you will see board consist of 6 row and seven column but there is seven row under the board i want not draw this
how can i stop loop from drawing this row ??
i do like this but also it is appear:
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.BLACK);
for (int c = 0; c < COL; c++) { // col from 0 to 6 (7 columns)
for (int r = 0; r < ROW; r++) { // row from 0 to 5 (6 rows)
g.drawLine(X_START, Y_START + DISTANCE, X_START * COL, Y_START + DISTANCE);
g.drawLine(X_START + DISTANCE, Y_START, X_START + DISTANCE, Y_START * ROW);
if (r == 6) { // the goal from this to not draw the seven row
continue;
DISTANCE += 100;
}Many thanks .
Edited by: beshoyatefw on Mar 21, 2010 6:18 AM -
Change display text in discoverer from database view
Hello,
I just wondered if it possible to do the following:
Create a discoverer report using e.g. person type field. In the database view the value required for this would be "Full-time" however when the user sees the value in the discoverer report the value is displayed as Employee type 1?
Can you change the text of a value a user sees in discoverer form what it is pulled out of the view as?
Please advise
Thank you
SarahHi Sarah
Yes you can do this. It is done as a calculation like this:
CASE
WHEN Person_Type = 'Full-time' THEN 'Employee type 1'
WHEN Person_Type = 'Part-time' THEN 'Employee type 2'
ELSE Person_type
END
You would call this calculation Employee Type and display it it in the report instead of Person Type.
Best wishes
Michael -
Hi,
I have this script and error :
Declare
Cursor C1 is
select d.product_code,b.responsibility_key from FND_USER_RESP_GROUPS_ALL a,fnd_responsibility b,fnd_user c,fnd_application d
where a.user_id = c.user_id
and a.responsibility_id = b.responsibility_id
and b.application_id = d.application_id
and c.user_name ='SYSADMIN'; -- user you want to copy
v c1%rowtype;
BEGIN
for v in c1 loop
FND_USER_PKG.AddResp('MYUSER',v.product_code, v.responsibility_key,
'Standard', 'DESCRIPTION', sysdate, null);
end loop;
END;
ERROR at line 1:
ORA-20001: APP-FND-02604: Invalide data
APPLICATION_SHORT_NAME=OE, RESPONSIBILITY_KEY=ORDER_ENTRY_SUPER_USER,
SECURITY_GROUP=Standard.
ORA-06512: Ó "APPS.APP_EXCEPTION", ligne 70
ORA-06512: Ó "APPS.FND_USER_PKG", ligne 2140
ORA-06512: Ó ligne 11
How can I exclude the case RESPONSIBILITY_KEY=ORDER_ENTRY_SUPER_USER,in my for v in c1 loop ? For example :
if v.responsibility_key=ORDER_ENTRY_SUPER_USER then go to next.
Many thanks.If I have understood it correctly...
If you dont want to see this value at all, then probably by adding this condition to where clause of the select query (of the cursor). Or trying out something with parameterised cursors.
Sidhu
Message was edited by:
Sidhu -
Remove text field from Array via for loop
Hi,
i have a problem to remove text fields added via for loop.
That im doing is, via for loop im dynamically creating menu with 10 buttons.
Each button contain, dynamically created, background (shape) and text field.
And everything is fine.
But when im try to remove text fields then i got this error:
- Im using button to remove text fields - lang_btn.addEventListener(MouseEvent.CLICK, clickHandler);
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at Loading_Img_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
In the script bellow marked with red is what should remove text fields from an Array, instead giving me error.
Here is my script
// Create for loop
for (var i:int = 0; i < 10; i++)
for each (xml in listItems)
if (i == xml.attribute("Id"))
// Add MovieClip to stage to hold the data
addChild(lmHolder);
lmHolder.x = 0;
lmHolder.y = 0;
// Create new MovieClip to hold buttons
lmButtonsMCArray[i] = new MovieClip();
lmButtonsMCArray[i].buttonMode = true;
lmButtonsMCArray[i].mouseChildren = false;
lmButtonsMCArray[i].x = 20;
lmButtonsMCArray[i].y = 20 + btCount * buttonSpace;
// Add each button MovieClip to lmHolder MovieClip
lmHolder.addChild(lmButtonsMCArray[i]);
// Create Background to buttons
lmButtonsArray[i] = new Shape();
lmButtonsArray[i].graphics.beginFill(lmBgColor0, 1);
lmButtonsArray[i].graphics.drawRect(0, 0, 230, 85);
lmButtonsArray[i].x = 0;
lmButtonsArray[i].y = 0;
// <<-- Add Background shape to the buttons MovieClips
lmButtonsMCArray[i].addChild(lmButtonsArray[i]);
// Create a new array to preserve data from XML List
lmNameArrayEG = new Array();
lmNameArrayUS = new Array();
// Create local variable to hold
var lmTxtFieldContentUS:String;
var lmTxtFieldContentEG:String;
var lmTxtContent:String;
// If clicked button is EG then make array with Arabic text
// If clicked button is US then make array with English text
if (footer.lang_btn.langState == "EG")
for each (var leftMenuName:XML in egLanguageList)
lmNameArrayEG.push(leftMenuName);
lmTxtFieldContentEG = lmNameArrayEG[i];
lmTxtContent = lmTxtFieldContentEG;
else
for each (var leftMenuNameUS:XML in usLanguageList)
lmNameArrayUS.push(leftMenuNameUS);
lmTxtFieldContentUS = lmNameArrayUS[i];
lmTxtContent = lmTxtFieldContentUS;
// Setup new text field each time script is executed
lmTxtFieldsArray[i] = new TextField();
lmTxtFieldsArray[i].width = 110;
lmTxtFieldsArray[i].border = false;
lmTxtFieldsArray[i].wordWrap = true;
lmTxtFieldsArray[i].multiline = true;
lmTxtFieldsArray[i].selectable = false;
lmTxtFieldsArray[i].embedFonts = true;
lmTxtFieldsArray[i].antiAliasType = AntiAliasType.ADVANCED;
lmTxtFieldsArray[i].autoSize = TextFieldAutoSize.CENTER;
lmTxtFieldsArray[i].text = lmTxtContent.toUpperCase();
lmTxtFieldsArray[i].x = 10;
lmTxtFieldsArray[i].name = "lmTxtFieldName" + i;
// <<-- Add Text fields to the Movie Clip
lmButtonsMCArray[i].addChild(lmTxtFieldsArray[i]);
// If clicked button is EG then set Arabic text format, and make array with Arabic text fields
// If clicked button is US then set English text format, and make array with Egnlish text fields
if (footer.lang_btn.langState == "EG")
lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_eg);
// Make array from text fields;
pushEgTFintoArray.push(lmTxtFieldsArray[i]);
else
lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_us);
// Make array from text fields;
pushUsTFintoArray.push(lmTxtFieldsArray[i]);
// If clicked button is EG then loop thrue the for loop and remove English text fields from array
// If clicked button is EG then loop thrue the for loop and remove Arabic text fields from array
if (footer.lang_btn.langState == "EG")
for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
//remove the text field array from the display
removeChild(pushUsTFintoArray[rNr_us]);
//clear the array
pushUsTFintoArray = [];
else
for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
//remove the text field array from the display
removeChild(pushEgTFintoArray[rNr_eg]);
//clear the array
pushEgTFintoArray = [];
btCount++;it looks like those tf's are children of lmButtonsMCArray[i], not the current scope. use:
if (footer.lang_btn.langState == "EG")
for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
//remove the text field array from the display
lmButtonsMCArray[rNr_us].removeChild(pushUsTFintoArray[rNr_us]);
//clear the array
pushUsTFintoArray = [];
else
for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
//remove the text field array from the display
lmButtonsMCArray[rNr_eg].removeChild(pushEgTFintoArray[rNr_eg]);
//clear the array
pushEgTFintoArray = []; -
Read data from text file one by one using for loop
Dear Forum
I want to read data of single colum of text file inside the for loop one by one(for each iteration value must be replaced by another value of text file).This value is used by a formula inside for loop. also after completion of iterations the values must be plotted on xy graph. How to do it.? please help me.
profraviIt's not very efficient to read a file line by line. Much simpler to read it all at once and then auto-index the results inside a for loop. The image below shows a generic solution to your problem. This assumes that the data in the file is in a single column.
I would also recomend checking ou the learning LabVIEW resources here.
I would aslos suggest that since this type of question is not specific to either NI-Elvis or the LabVIEW SE, you should post similar questions to the LabVIEW board. If you have problems, attaching a sample of the text file would help.
Message Edited by Dennis Knutson on 10-18-2007 09:11 AM
Attachments:
XY Graph From File.PNG 4 KB -
Hi everybody,
OS: Windows XP SP2
Forms: 10.1.2.0.2
Browser: FireFox 2.0.0.5
I have in my form (100 text items) and the following code:
DECLARE
i NUMBER := 0;
BEGIN
FOR i IN 1 .. 100 LOOP
SET_ITEM_PROPERTY( 'txt_segment_' || i , VISIBLE , PROPERTY_FALSE );
SET_ITEM_PROPERTY( 'txt_segment_' || i , ENABLED , PROPERTY_FALSE );
END LOOP;
END;
I want to reset all text items in my for loop i.e.
txt_segment_1 = '';
txt_segment_2 = '';
txt_segment_100 = '';
But I want to do it in the for loop, how ??
Please help, and best regards ('',)Kevin .. you are GENIUS ;)
It worked with NAVIGABLE set property.
I have another question since you're around :)~
I'm trying to concatenate all text items in a for loop into a varable x with the following code:
FOR i IN 1 .. 100 LOOP
COPY( x || 'txt_segment_' || i , x );
END LOOP;
but I end up with the following error:
FRM-40738: Argument 2 to builtin COPY cannot be null.
Its equivalent to the following code:
x := x || txt_segment_1;
x := x || txt_segment_2;
x := x || txt_segment_100;
OR equivalent to:
x := txt_segment_1 || txt_segment_2 || .. || txt_segment_100; -
Safari does not display text on some sites.
I am running OSX 10.10.2 and Safari 8.03
Some sites I visit do not display text at all.
For example: This site (http://neflin.org/) looks fine in Chrome, Firefox, whatever. But in Safari, it has no text at all. See below.
Mail is having difficult with some text in html email too.
I have rebooted, reset the PRAM, deleted preferences and turned off extensions. I checked the Guest account and created a new account and in all cases the problem persists.
I have validated fonts in Font Book, restored standard fonts and looked for duplicates. Nothing.
Flash and Java are up to date.
Any thoughts?Please read this whole message before doing anything.
This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
The purpose of this test is to determine whether the problem is localized to your user account. Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
Test while logged in as Guest. Same problem?
After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
*Note: If you’ve activated “Find My Mac” or FileVault in OS X 10.7 or later, then you can’t enable the Guest account. The "Guest User" login created by "Find My Mac" is not the same. Create a new account in which to test, and delete it, including its home folder, after testing. -
Issue with creating a text box from a loop
I was hoping someone could take a look at this code and maybe
help me find out why this isnt working. What I am trying to do is:
(NOTE: I have used a few differents scripts and combined them, so
the code may not be the greatest).
Pull Data from a PHP file (The PHP file gets it's data from
database)
Then run a loop that brings in First Name, Last Name, Jersey
Number, and Position
Then before it loops and gets the next player it creates an
array that creates 3 text boxes with Full Name, Jersey Number and
position
then it loops through the process again untill all of the
records have been retreived.
I'm not sure if its because I have a do while loop inside of
a for loop inside of a function and an Array. I'm new to Arrays and
loops. the issue is it wont display the text boxes.
NOTE: When I trace this, the data is being retrieved.
Thanks for the help"this" inside your onLoad() method refers to your loadvars
instance, receive. and the loadvars class has no createTextField()
method, so you're not going to create any textfields if that code
is in the onLoad() body.
to remedy, reference a timeline instead of receive. -
How to output last 4 arrays from a For Loop?
Hi People,
I am almost at the end of my tether. I really hope someone could please help me.
Any input would be welcome. VI attached.
VI explanation:
I initialize an array.
The random number generator simulates my camera input.
Depending on which iteration it is, the data is added into one of four output arrays.
'x-y*floor(x/y)' gives a remainder value of 0, 1, 2 or 3.
'Case Selector' just adds 1 to 'x-y*floor(x/y)' to get case 1, 2, 3 or 4.
Shots 1, 5, 9 etc are added to Array 1 (Case 1).
Shots 2, 6, 10 etc are added to Array 2 (Case 2).
Shots 3, 7, 11 etc are added to Array 3 (Case 3).
Shots 4, 8, 12 etc are added to Array 4 (Case 4).
Averaged Output displays the averaged value i.e. the total value divided by the number of shots saved in that array ('Set (IQ+1)').
My problems are:
1) I would like to output only the last 4 sets of data from the Averaged Output 1, 2, 3 and 4 to 4 different files (i.e. save as .csv what is displayed onscreen in indicators 'Averaged Output 1', 2, 3 and 4 at the end of all iterations.
Where should I place my file save diagram disable so that it does this?
Putting it outside the main For Loop with auto-indexing on gives me one file with all previous data. (This is not feasible as my number of shots should number in the thousands)
Putting it outside the main For Loop with auto-indexing off gives me only the last set of data. (I need the output for 4 Arrays, not just the last run)
Putting it inside the main For Loop (as shown) gives me the same number of files as number of iterations. (Again not feasible due to large number of files that will be generated and slow camera capture)
For the sake of fast camera capture, I would like these 4 files to only output once all the image captures are complete.
2) Would preferably like to name the file once and for the programme to append '(1)', '(2)', '(3)' and '(4)' to filename of the appropriate 'Averaged Output' Arrays but file path controls are another big headache for me.
3) P.s. is initializing one array enough to avoid using Memory Manager? Or should I initialize 4 arrays?
I am using Labview 2010.
Thanks so much,
Jaslyn
Solved!
Go to Solution.
Attachments:
Help Understanding Arrays and file paths (10).vi 26 KBThanks so much Lennard!!
Hi JKSH,
I've been busy trying to complete the dang code, but for completeness so that other users can learn too, I shall answer your queries. Thanks for looking in.
First, what do you mean by "add"? Your code in your case strcuture sums your input values, so your array size doesn't change. However, you also said "Putting it outside the main For Loop with auto-indexing on gives me one file with all previous data. (This is not feasible as my number of shots should number in the thousands)" -- it sounds like you are expecting an array with thousands of elements. So, what should "Output Array N" look like?
Ans: Output Array N should be a 4x4 array of the summation of all the numbers generated during every 4th iteration.
i.e. if random number 1=1, random number 2=2, etc, And 'No of iterations' is 12,
Output Array 1 should be 1+5+9:
15 15 15 15
15 15 15 15
15 15 15 15
15 15 15 15
(Note: Most of your arrays are 4x4, but in Case #2 you created 128x128. I prersume this is a typo?)
Ans: Kind of, I'm using a 4x4 array of randomly generated numbers as an example but my actual data will be the 128x128 pixel output of a camera. And during actual experimentation, 'No of Iterations' will number in the thousands.
Second, why do you add your "simulated camera input" to the "Initialized Array"? You can add it direcly to the previous output inside your case structure.
Ans: See answer to question 3
Third, have a look at shift registers: http://www.ni.com/gettingstarted/labviewbasics/shiftregisters.htm. Use them instead of Feedback Nodes to make your code tidier.
Ans: I did try.. But I can't seem to add shift registers to the case structure, only the for loops outside. Are you sure it can be done..?
jaslyn wrote:
1) I would like to output only the last 4 sets of data from the Averaged Output 1, 2, 3 and 4 to 4 different files (i.e. save as .csv what is displayed onscreen in indicators 'Averaged Output 1', 2, 3 and 4 at the end of all iterations.
Where should I place my file save diagram disable so that it does this?
For the sake of fast camera capture, I would like these 4 files to only output once all the image captures are complete.
You will need to call "Write to Text File.vi" 4 times to write 4 files. So, you should finish your loop, then call this VI 4 times.
Ans: How do I get it to extract the data from each of the 4 cases in my case structure?
jaslyn wrote:
2) Would preferably like to name the file once and for the programme to append '(1)', '(2)', '(3)' and '(4)' to filename of the appropriate 'Averaged Output' Arrays but file path controls are another big headache for me.
You can create strings first, then convert them into paths: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/string_to_path/
Thanks
jaslyn wrote:
3) P.s. is initializing one array enough to avoid using Memory Manager? Or should I initialize 4 arrays?
I'm not sure what you're asking; can you please clarify what you mean by "avoid using Memory Manager"? But anyway, you've actually initialized FIVE arrays: 1 outside the loop, and 1 inside each case.
I've read that to avoid fluctuations in memory usage, it is a good idea to initialize arrays to their expected size before the start of data collection. That was just what I was trying to do. -
How to prevent a text in script from displaying if its value is zero
Dear all,
How to prevent a text in script from displaying if its value is zero
for eg Price = 0.00
if price is 0 it should'nt appear in output.
I tried with if price ne 0.
price = &price&
endif.
but it's not working.
Regards
Raj
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jan 20, 2009 8:59 AMHello Nagaraju,
What you were doing is partially right.
The correct format to write in the script is as follows :
/: if &PRICE& ne 0.
&PRICE&
/: endif.
This should work. Let me know how it goes.
Nayan
Maybe you are looking for
-
Client/server program validation - is it possible?
I've been mulling over this problem for a few days, and am starting to wonder if it's theoretically possible to find a solution. I'm not looking for specific code, this probably won't even be implemented in Java, I'm just wondering if there is a theo
-
Buying a new iPod,,how can I transfer all my songs over?
My 30gb iPod which I've had since May of 2006 sad to say may be on it's last legs. It did not make it through my morning workout today, crapped out at the 15 minute mark. I think it was fully charged, the battery indicator showed a full charge when I
-
JavaScript Cross Browser Incompatibility
Hi All, I would like to know the list of JavaScript methods that won't work properly or dosen't support in Internet Explorer v6.0, 7 and Mozilla Firefox v2.0 browsers. Best Regards, Suresh
-
Reporting Sevices 2005 hangs every time after 3min running on Win 2008 R2
Dear all, we installed Reporting Services 2005 Standard Edition running latest SP4 and Cumulative Update on Windows Server 2008 R2 x64 Enterprise Edition. The Server has 128 GB of RAM with 12 physical / 24 logical cores. So far the Reporting Services
-
Can someone help me move the AM in my program so that it appears under the time. Also, does anyone know how to put zero,s on the clock when you have single digit numbers, e.g 10:01:03 instead of 10:1:3. Thank You! import java.io.*; import java.awt.*;