LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Writing to/Reading from a Binary file placed in a Loop

Solved!
Go to solution

Hi

 

As you can see in the attahced image, I attempt to write a set of 2*202 data in each iteration of the loop of the loop, yet when I try to read the data (in the second picture) I only get the first (or last, I assume) set of data, up to index 202. I needed to read two set (X, Y) of 402 valuse. So, I am not sure if I am making a  mistake in wrting to the file or reading from it! 

 

I really appreciate it if someone could suggest a solution 🙂

 

Ashakn

 

 

Download All
0 Kudos
Message 1 of 7
(3,308 Views)

You are only reading the first.  In your read, set your number to read to -1.  That will tell the Read Binary File to read all of the data instead just a single set.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,303 Views)

Hey crossrulz 🙂

 

Sorry for my delayed response, I was on a vacation during the last two weeks.

Thanks for your reply. I tried your suggestion, it changed the look of data set in front panel, still I don't have access to the second set of data. 

I have attached the result in a jpg file. Also, you can find the binary file (it should have 4 sets of data since I ran the code two times) and a CheckData.vi file in the attachment, I really appreciate it if you could take a look into the files.

 

Thank a lot 🙂

Download All
0 Kudos
Message 3 of 7
(3,042 Views)
Solution
Accepted by topic author Ashkan22

Your file only has 1 set of data in it.  But looking at the code for writing the file, I think your error is with the setting of the file position.  The default position is the beginning of the file, which means you will just be overwriting whatever data you have in the file.  You need to tell it to set to the End of the file by setting the "From" input to "End".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(3,025 Views)

You are right!...It's funny, somehow I have used the "set file postion" vi but forgot to set the position. Thanks 🙂

 

 

0 Kudos
Message 5 of 7
(3,009 Views)

@Ashkan22 wrote:

You are right!...It's funny, somehow I have used the "set file postion" vi but forgot to set the position. Thanks 🙂


I don't see any thanks...(give this a read: Unofficial Forum Rules, especially the park on "giving thanks").


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(3,004 Views)

I didn't know the rules 😄 Thank you again.

0 Kudos
Message 7 of 7
(2,984 Views)