Set file position within a for loop, error 1
Hi, I'm reading from a .sxm file consisting of a large chunk of text followed by binary data for 512x512 images with 4 bytes per pixel
I’ve managed to successfully identify the start of the binary and read the first image from the file and view it using "flatten pixmap.vi", so I’m doing something right, however when i try to read the next chunk of image data in the .sxm file using a for loop, set file position keeps churning out ERR (1).
im at a loss as to whats causing this
Solved!
Go to Solution.
Attachments:
binaryread3d trouble.vi 22 KB
back panel screenshot.png 27 KB
I closed the file in the loop, doh! ... another morning well spent
Similar Messages
-
How do I set a variable within a 'for' loop grid array
I'm afraid I'm stuck again!
The next stage in the animation that I'm working on, is to set up a boolean, 'drilled = 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 becomes 'drilled = true', but only for that instance that has been clicked.
What I've done is to set the variable (boolean)(highlighted in bold below) within both 'for' loops within the grid array, but it just returns an undefined value. Do I need to setup a separate array? (see code below):-
//set up grid for solid array
var spacing:Number = 5.75;
var cols:Number = 20; // number of columns in grid
var rows:Number = 20; // number of rows in grid
var leftMargin:Number = 154;
var topMargin:Number = 169;
var depth:Number = 100; // starting point for depth
var drilled:Boolean;
for (i=1; i<=rows; 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 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'd be grateful for any help. Thanks.I'm sorry for asking this question again, but I really need to have the 'drilled' variable to be available at all times outside the openCircle_mc, so if I can set up the 'drilled' variable as an array that would be good. Below is the code that isn't working:
/* set all values of 'drilled' to false */
var col:Number = 20; // number of columns in grid
var row:Number = 20; // number of rows in grid
for (g=1; g<=row; g++) {
for (h=1; h<=col; h++){
drilled[g,h] = false;
Very many thanks -
Reading a csv file within a for loop
Hi guys,
Im trying to read a csv file within a for loop and the while loop only seems to be getting executed once rather than the number of times that is specified.
for(int i=0; i<paramValues.length;i++)
String StudentNo = paramValues4;
out.println("StudentNo="+StudentNo);
BufferedReader in = new BufferedReader( new InputStreamReader( conn2.getInputStream()));
String readLine; // stores a line from the file as a string//used to get rid of the first line which has course name
readLine = in.readLine();
int NumberOfElementsInArray=16;
String[] data;
data = new String[NumberOfElementsInArray];
data[0]=> StudentNo
data[1]=> Surname
data[2]=> Firstname
data[3]=> ExamNo
data[4]=> YrOfStdy
data[5]=> ProgOfStdy
data[6]=> Fld1
data[7]=> Fld2
data[8]=> DegType
data[9]=> EnrolStatus
data[10]=> StaffAdvNo
data[11]=> Tutor
data[12]=> Fld3
data[13]=> Fld4
data[14]=> Fld5
data[15]=> Pegged
data[16]
//out.println("<table border=\"1\">");
int datanumber=0;
while( (readLine = in.readLine()) != null )
out.println("ive entered the loop");
StringTokenizer tokens = new StringTokenizer( readLine, ",", true);
boolean prevTokenComma = true;
boolean emptyValue = false;
String aValue = null;
datanumber=0;
while( tokens.hasMoreTokens() )
aValue = null;
String token = tokens.nextToken();
token=token.trim();
//if the token does not equal to a comma
if( !token.equals(",") )
aValue = token;
prevTokenComma = false;
emptyValue = false;
else if( token.equals(",") && prevTokenComma )
prevTokenComma = true;
emptyValue = true;
else //( token.equals(",") && !prevTokenComma )
prevTokenComma = true;
emptyValue = false;
if(emptyValue)
aValue = "";
// Printing values
if( aValue == null)
//do nothing
else if (aValue.equals("") )
aValue=" ";
data[datanumber]=aValue;
//out.println("datanumber="+datanumber);
//out.println("<td> aValue: "+aValue+"</td>");
datanumber++;
else
data[datanumber]=aValue;
//out.println("<td> aValue: "+aValue+"</td>");
//out.println(datanumber);
datanumber++;
out.println("data[0]="+data[0]);
//out.println("data[3]="+data[3]);
//out.println("ExamNo="+ExamNo);
}//end while
in.close();
}//end for loop
When I print the variable student no at the beginning of the for loop it prints the different studentno's so the for loop is fine, but the while loop gets executed once. Does anyone know why????????/
Thanks
TzafPROBLEM SOLVED....
Basically the following declarations have been done within the for loop....
URL url2 = new URL ("http://localhost:8080/FYP/CSVFILES"+Year+"/"+WebCourse2+".csv");
URLConnection conn2 = url2.openConnection();
HttpURLConnection uc = (HttpURLConnection)conn2;
uc.connect();
try
responseCode = uc.getResponseCode();
out.println("Response code1: " + responseCode+"\n");
catch(IOException e)
responseCode = uc.getResponseCode();
//out.println("Response code2: " + responseCode+"\n");
thanks
anyway
tzaf -
Hi,
I am using LabVIEW 2009 SP1 on Win XP OS system. I am reading and writing data to a text file whose size does not exceed 50 MB. whenever i try to set file position to a value of say 128 bytes from the start of file, the function does not show an error. But when i try to read back the file position using get file position function, the value shows a very high number. I am not able to do a random access read of the file data. Please help.
Regards,
YashasviHi Yashasvi,
can you post the vi (or vi section) causing the problem?
Thanks,
Marco -
Set file filters in flex for save, not for browse
How can i set file filters in flex for save, not for browse?
Right now i am using filereferce class for saving purpose but i could
not able to set filter. We can easily do it for browse.You can try to delete [http://kb.mozillazine.org/mimeTypes.rdf mimeTypes.rdf] in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
* http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions
Create a new profile as a test to check if your current profile is causing the problems.
See:
* [https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile Basic Troubleshooting: Make a new profile]
There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
If that new profile works then you can transfer some files from the old profile to that new profile (be careful not to copy corrupted files)
See:
* http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox -
Unable to put a timed structure in a parallel for loop, error -808
If I try to place a Timed Structure in a Parallel For Loop, the TS needs a different structure name per instance to prevent collisions. However, setting the Structure Name node to something unique per instance doesn't work, I get error -808. Have I missed something?
Thoric (CLA, CLED, CTD and LabVIEW Champion)That got me thinking - something to do with the number of compiled parallel instances.
Indeed, the compiler creates a number of parallel instances of the for loop in the compiled code (in my case 8), and uses the number requested at the Parallel Instances terminal (just under the Iterations terminal), which is set to 2. Therefore the compiler has created 8 instances of the Timed Structure, each in its own for loop instance, but they all have the same defined Structure Name. When launched, there is an immediate conflict because they can't share the same name, and error -808 is launched before the set Structure Name function can change it. Hence the error still shows when requesting only one instance, because the other seven still exist.
I guess this means you can't have Timed Structures (or Timed Loops for that matter too) in a Parallelised For Loop?
Thoric (CLA, CLED, CTD and LabVIEW Champion) -
Hi,
I'm using labVIEW V5.1
I'm trying to generate 10 1D arrays, the first array is initialized to all zeroes, then I have set up a for loop which shifts the first element by 1, then a random number is placed into the first element position. I am using a shift register to feed back in the newly generated array into the start of the loop.
By the end of the each loop I want to be able to use the array generated in an algorithm outside the loop. However I only want the Nx1 array that has just been generated.
Unfortunately, I cannot figure out how to resize, reshape or index the output array to do this.
I would like the loop to
give me out a 1D array after each iteration.
Any help would be greatly appreciated.I hope I've understood your problem.
First your vi was lacking of the sub-vi working as shift register, I've replaced it with the rotate function.
The indexing of your arrays create a 2D array whose rows are your 1D array.To pick only one of them you have to use the index array function and select which one you want.
To use your temporary data in another part of your application you should use a local variable of array2.
I did it in a separated while loop That I syncronized with the for loop using occurrence, in this way the while loop runs each time a new value is inserted in array2 (each loop of the for loop structure).
If you don't need this syncronization just get rid of occurrence functions.
I place a delay in the for loop to show what happens when running.
Hope it was helpful.
Alberto Locatelli
Attachments:
array_test_v3.vi 35 KB -
OnLoadInit within xml for loop
Hi,
I have some code that loads in xml which works fine (see
below)
I have a for loop, and based on the content of the XML, swf's
are loaded in to moving clips.
when each of the swf's have completed loading in I need to
change the clips scale, position etc.
I need to indroduce to the code below some way of detecting
when each swf is loaded. I have been doing research and know I need
to integrate a loadInit function into the code. I have tried
alsorts and looked at alot of code but can't seem to get anything
working.
If any of you can poinbt me in the right direction that would
be great.
stop();
var y:XML = new XML();
y.ignoreWhite = true;
var page_cat_ids:Array = new Array();
var page_cat_names:Array = new Array();
y.onLoad = function() {
var category:Array = this.firstChild.childNodes;
for (i=0; i<category.length; i++) {
page_cat_ids.push(category
.attributes.cat_id);
page_cat_names.push(category.attributes.cat_name);
duplicateMovieClip(_root.characterClipContainer.characterClip,
"characterClip"+i,
_root.characterClipContainer.getNextHighestDepth());
_root.characterClipContainer["characterClip"+i]._x = 100*i;
_root.characterClipContainer["characterClip"+i].characterClipName.text
= page_cat_names
_root.characterClipContainer["characterClip"+i].characterClipImage.loadMovie("../images/f lash/characters/"+page_cat_names+".swf");
y.load("../xml/categories_page_1.xml");Sorry, I missed something out.
there is however another problem. As the code loops it is
adding the page_cat_names to each other. Because of this the movie
is loading in the first swf but can't find the others becuase they
dont exist.
see the error from my output panel below. the trace is coming
out at the end though. -
File TO File-Using XSLT mapping (for Beginners) --- Error in XSLT
Hi,
I am following this wiki (TO File-Using XSLT mapping (for Beginners))
https://wiki.sdn.sap.com/wiki/display/XI/FileTOFile-UsingXSLTmapping%28forBeginners%29
When creating Xslt from the MapForce, when I click on the XSLT Tab I am getting the following error
http://www.flickr.com/photo_zoom.gne?id=1216715484&size=o
How to correct this error ?.....
Thanks
srini
Message was edited by:
srinivasHello,
The XSD you are using is from Data Type and you are using it for mapping.
Instead export XSD for Message Type and also pass the XML schema for source that will solve the issue and your XSLT will be generated.
Regards, -
Problem cycling through elements of an array using a for loop ~ error 200609?
Hi,
I'm outputting a 194-element array from a MATLAB script node into a for loop where the array is indexed then converted into a 8-bit boolean pattern which I'm trying to output using DAQ Assistant. I'm using LabVIEW 8.2 and a PCI 6133 DAQ using a counter(Ctr0InternalOutput) to time the output. The first element of the array goes through the loop perfectly however never makes it's way back through and throws error 200609: Generation cannot be started because the slescted buffer size is too small. Increase the buffer size. After probing the line before DAQ Assistant I confirmed only one element makes it through the loop and then throws this error? I've trying doing the same things with lower lowel DAQmx vi's using a DAQmx configure output buffer vi to override this buffer size problem, but still get the same result(not the error but same data flow problem)? Anybody know what's going on? I've included the vi's I've been working with. Thanks!
Millie
Attachments:
Untitled 22.vi 228 KB
Untitled 34.vi 180 KBHi,
I'm outputting a 194-element array from a MATLAB script node into a for loop where the array is indexed then converted into a 8-bit boolean pattern which I'm trying to output using DAQ Assistant. I'm using LabVIEW 8.2 and a PCI 6133 DAQ using a counter(Ctr0InternalOutput) to time the output. The first element of the array goes through the loop perfectly however never makes it's way back through and throws error 200609: Generation cannot be started because the slescted buffer size is too small. Increase the buffer size. After probing the line before DAQ Assistant I confirmed only one element makes it through the loop and then throws this error? I've trying doing the same things with lower lowel DAQmx vi's using a DAQmx configure output buffer vi to override this buffer size problem, but still get the same result(not the error but same data flow problem)? Anybody know what's going on? I've included the vi's I've been working with. Thanks!
Millie
Attachments:
Untitled 22.vi 228 KB
Untitled 34.vi 180 KB -
Is there any point in having an ORDER BY clause within a FOR LOOPs counter?
DB Version:10.2.0.1.0
I need to loop through empno's using a FOR loop. But is there any point in having an Order by clause within SQL as shown below. This only degrades the performance because of the unnecessary sorting by the ORDER BY clause. Right?
begin
FOR i IN (select empno from emp ORDER BY sal ASC) LOOP
curr_stat_id := i.empno +p_gennum;
.First question you should ask to your self is
"Do i need a FOR LOOP. Cant i do it in a straight SQL"
If the answer is NO (Which is not in several cases) then the next question is.
"What is my requirement"
Having an order by in the Select is totally pertained to your requirement. If your requirement
says you should loop through the employee based on there salary for lowest to highest then yes you
need an order by.
So more than performance point of view its requirement point of you. But if you are more concern about
performance you will first ask to your self
"Do i need a FOR LOOP. Cant i do it in a straight SQL"
Thanks,
Karthick. -
Writting exception within cursor for loop
I have two cursor for loop as
for rec1 in () loop --loop 1
for rec2 in () loop --loop2
<statements>
end loop;
end loop
Now I want to handle exception within my second for loop so that after terminating the loop it will again go to the first loop...
How to do it ? Please help......you may
BEGIN
FOR rec1 IN your_select1
LOOP --loop 1
BEGIN
FOR rec2 IN your_select2
LOOP --loop2
statements;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
log_error;
END;
END LOOP;
END;or ...depending on your exact needs:
BEGIN
FOR rec1 IN your_select1
LOOP --loop 1
FOR rec2 IN your_select2
LOOP
BEGIN --loop2
statements;
EXCEPTION
WHEN OTHERS
THEN
log_error;
END;
END LOOP;
END LOOP;
END; -
Truncating an array within a for loop
I'm currently working with a program that builds an array of 3000*N real numbers, where N is a control that I specify. I want to pass this array into a for loop that runs N times, each time splitting the first 3000 numbers of the array. So, in other words I want the for loop to execute enough times such that the initial array will be completely divided into groups of 3000 when I'm finished. Later I'll be finding the maximum value of all of these subarrays and taking the average of those. What I tried first is to pass the array into the for loop, then truncate it at index = 3000, but the problem is that I can't hard code the loop to do this N times. Any advice or other methods you'd recommend for doing this?
Thanks.
Message Edited by Robtn on 03-05-2010 03:17 PMMark--I don't think I can use that approach. Let me be more specific on what the problem is:
Our "big program" is a giant while loop that constantly reads in voltage values from a DAQ assistant.
It has two modes, the first of which I'm having a lot of trouble with. This mode uses a for loop (N = 3000) nested within the giant while loop.
When the for loop activates, the DAQ assistant takes reads 300 samples for every iteration and takes the maximum of those 300 values. It then builds an array composed of all the maxima. After the for loop has executed 3000 times, a case structure activates, which then finds the maximum of the array of maxima.
I want this (N=3000) for loop to execute an arbitrary number of times, a number that I will specify. Each of those times it should generate a completely seperate array of maxima. So, if I want the for loop to run 5 times, I want 5 different arrays.
My approach for doing this was to change N=3000 to say N = 15000, then split up the resulting array 5 times. So, I need an entirely separate for loop that reads in this array of 15000 maxima on its own and splits it 5 ways. I think what you're suggesting is to use a for loop outside of the N=3000 loop, which is a good idea in theory, but experience has shown that this will not generate 5 separate arrays. It will actually concatenate each array into one, hence the problem we currently have.
Yik--I won't have access to Labview over the weekend. Is it possible to take a screenshot and post it, or maybe a short description?
Thank you for the responses. -
Setting up a dailog box for an error message
Hello everybody
we need to display the error message that is being displayed at the bottom of the window in the portal through a pop up box.Is there a property that can be changed for an error to appear as a pop up instead of in the status bar.We are in EP6.0 SP2.
any help is appreciated greatly.
ThanksThis issue can be caused by an extension that isn't working properly.
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes -
Hi all Community members,, I am facing problem with pulling attributes from a xml which I have created. I am using nested for loop. Please kindly help me out to solve this problem....
Thanks in advance...
Below is the code & xml ...
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.*;
import flash.net.*;
var myXML:XML;
var voiceOver:String;
var startOffset:Number;
var slideData:Array;
var id_cont_array:Array = new Array();
var id_textfield_array:Array = new Array();
var id_image_array:Array = new Array();
var myXML_Container_Length:Number;
var myXML_textField_Length:Number;
var myXML_images_Length:Number;
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("dynamic.xml"));
loader.addEventListener(Event.COMPLETE,processXML);
function processXML(e:Event):void
slideData=new Array();
myXML = new XML(loader.data);
loader.removeEventListener(Event.COMPLETE, processXML);
loader.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
myXML = new XML(e.target.data);
voiceOver = myXML. @ voice_over;
startOffset = myXML. @ start_offset;
for (var i : uint = 0; i<myXML.*.length(); i++)
//trace(myXML + "slide");
//myXML_List = myXML.children();
myXML_Container_Length = myXML.children().length();
//trace(myXML_Container_Length+ "==myXML_Container_Length")
//myXML_textField_Length = myXML.containerss[0].children().length();
//myXML_images_Length = myXML.children().length();
//trace(myXML.child("containerss")[3]. @ id.toXMLString()+ "==myXML.containerss[0]. @ id;");
//trace(myXML.containerss[0].textfield[0]. @ id+ "==myXML.slide.containerss[0]. @ id");
//trace(myXML.containerss[0].textfield[1]. @ id+ "==myXML.slide.containerss[1]. @ id");
//trace(myXML.containerss[3].image[0]. @ id + "==image[0]");
//trace(myXML.containerss[0].children() + "==myXML.containerss[0].children()");
for (var j:Number=0; j<=myXML_Container_Length; j++)
id_cont_array.push(myXML.containerss[j]. @ id);
//trace(myXML.containerss[j].children().length() + "==j");
myXML_textField_Length = myXML.containerss[j].children().length();
trace(myXML_textField_Length + "==myXML_textField_Length");
for (var k:Number=0; k<=myXML_textField_Length-1; k++)
id_textfield_array.push(myXML.containerss[j].textfield[k]. @ id);
//id_image_array.push(myXML.containerss[k].image[j]. @ id);
trace(id_textfield_array[k] + "==id_textfield_array[k]==" + k + "---j==" + j);
//trace(id_image_array[k] + "==id_image_array");
//trace(id_textfield_array[j]+"==id_cont_array[j]");
//trace(myXML_List.length() + "===myXML_List");
function loadError(e:IOErrorEvent):void
trace("loadError");
/// XML is as given below..
<slide orientation="VERTICAL" voice_over="Slide1.mp3" start_offset="0" margin="">
<containerss id="0" orientation="HORIZONTAL" padding="10" margin="10" x="10" y="160" width="200" height="150">
<textfield id="Text1" text="textfieldText1" padding="10" margin="10" x="10" y="160"/>
<image id="img1" text="" padding="10" margin="10" x="10" y="160"/>
<textfield id="Text2" text="textfieldText2" padding="10" margin="10" x="10" y="160"/>
</containerss>
<containerss id="1" orientation="HORIZONTAL" padding="10" margin="10" width="200" height="200" x="10" y="160">
<textfield id="Text3" text="textfieldText3" padding="10" margin="10" x="10" y="160"/>
<image id="img2" text="" padding="10" margin="10" x="10" y="160"/>
</containerss>
<containerss id="2" orientation="VERTICAL" padding="10" margin="10" width="200" height="150" x="10" y="160">
<textfield id="Text5" text="textfieldText5" padding="10" margin="10" width="200" height="150" x="10" y="160"/>
<image id="img3" text="" padding="10" margin="10" x="10" y="160"/>
<textfield id="Text6" text="textfieldText6" padding="10" margin="10" x="10" y="160"/>
</containerss>
<containerss id="4" orientation="VERTICAL" padding="10" margin="10" width="200" height="150" x="10" y="160">
<textfield id="Text7" text="textfieldText7" padding="10" margin="10" width="200" height="150" x="10" y="160"/>
<image id="img4" text="" padding="10" margin="10" x="10" y="160"/>
<textfield id="Text8" text="textfieldText8" padding="10" margin="10" width="200" height="150" x="10" y="160"/>
</containerss>
</slide>Parsing is totally wrong. You function processXML() should be like that:
function processXML(e:Event):void
slideData = new Array();
loader.removeEventListener(Event.COMPLETE, processXML);
loader.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
myXML = new XML(e.target.data);
voiceOver = myXML.@voice_over;
startOffset = myXML.@start_offset;
myXML_Container_Length = myXML.children().length();
var node:XMLList;
for (var j:Number = 0; j <= myXML_Container_Length - 1; j++)
id_cont_array.push(myXML.containerss[j].@id);
node = myXML.containerss[j].children();
myXML_textField_Length = node.length();
for (var k:Number = 0; k <= myXML_textField_Length - 1; k++)
switch (node[k].name().toString())
case "textfield":
trace(node[k].@id);
id_textfield_array.push(node[k].@id);
break;
case "image":
id_image_array.push(node.@id);
break;
Maybe you are looking for
-
Problem in sqlplus 10.2.0.4
Hi, I have a strange problem. Today we graded DATABASE from 10.2.0.2 to 10.2.0.4. Upgrade went through smooth. there were no errors. When we are executing a select statement from SQL Client(10.2.0.2) it is talking long time than expected. But the sam
-
My iTunes wont accept half my songs?
Recently I got a new computer and did not back up my itunes, ive been trying to put all of my songs onto my new itunes from my iphone by using an extracting tool. i managed to obtain all of the music from my iphone which i was planning to put onto my
-
Hi, How do we create a workflow in SAP ISU? Is it a standard function in SAP or require development of custom program? Thanks & Regards, Rishi
-
Hi, Can you please explain me FI process Record-to-Report. We have Order-to-cash and Procure-to-pay in SD and MM modules. What are the processes/flows in FI and CO modules. If you have any documents please send the docs to [email protected] I will re
-
How to send personalized mass emails on my Mac?
I am trying to help my daughter send out letters to colleges via email. How do I send personalized mass email messages on my MacBook Pro? I know how to do it on my PC..... I figured out how to do a mail merge letter, but I would like to send it via