LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create 2D array of 1D aray of String

Ofcourse, I tried running your code.

Error stated:

LabVIEW load error code 10: VI version(5.1) is too old to covert to the current LabVIEW version(8.5).

 

And yes, your code looks really simple and easy to follow.:smileyhappy:

But just help me out  with the error code i am getting while opening ur code.

 

Thanks,

Ritesh

0 Kudos
Message 21 of 34
(1,540 Views)

altenbach wrote:

(Your program is way too complicated. 🙂 It is very expensive to read a file line-by-line


          Could you please enlighten me on this like How is it expensive if i read a file line by line ?

          N how will it Help if i read the whole file in a String and then process the string to get the desired output?

 

Thanks,

Ritesh 

0 Kudos
Message 22 of 34
(1,537 Views)

ritesh024 wrote:

LabVIEW load error code 10: VI version(5.1) is too old to covert to the current LabVIEW version(8.5).


My code parse3.vi in in LabVIEW 8.5.1. There is nothing even remotely resembling 5.1 so I don't know what's wrong. Clear your browser cache and try downloading it once more. Maybe you got a corrupt download.

 

Just in case, I have downconverted the new version (parse4.vi) it to 8.2, so try this one. (I added the transposition and reading of the file. I have slighly modified the input data file and removed the last zero at the end (also attached). the lone zero at the end interfers with my algorithm)

0 Kudos
Message 23 of 34
(1,536 Views)

ritesh024 wrote:

          Could you please enlighten me on this like How is it expensive if i read a file line by line ?

          N how will it Help if i read the whole file in a String and then process the string to get the desired output?


Reading from the HD is much more expensive than reading from memory. You do a new file IO operation for each line, but since the lenght of a line is variable, the program needs to read form the current position character by character until if finds a newline before it can know where the line ends and how much to read. Of course smart algorithms and disk caching improve these operations, but they are still much less efficient. Remember a file is just one long string of characters! There is no structure and the concept of a "line" does not exist per se, it is just the occurence of certain characters (\n, \r) scattered among other characters.

 

In my version, there is one single file IO operation and we know exactly how many characters to read (from the file size!) so all can be done very efficiently.

Message Edited by altenbach on 09-30-2008 01:52 AM
Message 24 of 34
(1,534 Views)

Hey,

Thanks a lot for your consistent Help!  :smileyhappy:

Your code now works fine on my PC.

You have reduced that code to heck and made it so simple to implement and understand.

And, thanks for teaching the basic concepts of reading a file. :smileyhappy:

I hope it might have Helped others too.

 

Regards,

Ritesh

0 Kudos
Message 25 of 34
(1,508 Views)

ritesh024 wrote:

          Could you please enlighten me on this like How is it expensive if i read a file line by line ?

          N how will it Help if i read the whole file in a String and then process the string to get the desired output?


Let's see if describing it another way would help.
Imagine two people preapring the same meal. 
Person 1 represents reading the entire file then processing the data.  Person 2 represents reading a file line by line and processing data at each line.  Let's look at the scenarios...
Person 1:
Goes to the refrigerator and grabs all the vegetables, meat and seasoning to prepare the meal and brings it all to the counter for processing.  Cleans the vegetables (4 potatoes and 6 carrots) and dices 3 pieces of meat.  The process includes cleaning the knife after processing one type of item.  All ingredients are put in a pot with water and seasoning (salt & pepper) to cook.
Person 2:
Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife.  Goes to the refrigerator and grabs one potatoe. Cleans it. Cleans the knife. Goes to the refrigerator and grabs one piece of meat. Dices it. Cleans the knife. Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife.  Goes to the refrigerator and grabs one potatoe. Cleans it. Cleans the knife. Goes to the refrigerator and grabs one piece of meat. Dices it. Cleans the knife. Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife.  Goes to the refrigerator and grabs one potatoe. Cleans it. Cleans the knife. Goes to the refrigerator and grabs one piece of meat. Dices it. Cleans the knife. Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife.  Goes to the refrigerator and grabs one potatoe. Cleans it. Cleans the knife. Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife. Goes to the refrigerator and grabs one carrot. Cleans it. Cleans the knife. All ingredients are put in a pot with water to cook. Pickup up the salt and adds seasoning. Pickups up the pepper and adds seasoning.

 

 

Which of the two will accomplish the task first?  Person 1 or Person 2?  The answer is obvious.

 

R

Message 26 of 34
(1,506 Views)

Just saw your reply.  Altenbach is our resident expert at optimizing code 😉

 

Was hoping to write my little story faster... LOL!  It kinda describes the difference in non technical terms.  Plus I enjoy cooking 😉

LOL! 😄

0 Kudos
Message 27 of 34
(1,504 Views)

Here's another analogy:

 

Problem: You need to mail a 500 page report to the branch office.

  1. Place the 500 pages in a big envelope, put a label on it, and drop it off at the post office.
  2. Place each page in a seperate envelope, write 500 labels and walk 500 times to the post office.

What solution is more efficient? 😄

 

 

Message 28 of 34
(1,491 Views)

The 2nd solution..

 

Because by walking 500 times to the post office, you will get in better shape and start jogging instead of walking.  Furthermore, by buying 500 stamps, you help the economy, although environmentalists will hate the fact that you used 500 enveloppes, so just don't tell them. 

 

😉

 

there was more, but I thought it would be better to keep it short...

Message Edited by JoeLabView on 09-30-2008 12:59 PM
Message 29 of 34
(1,481 Views)

Suddenly, all this reminds me of stories such as this:

 

The Bank that was sent Through the Post office

 

So, yes, under certain situations, even this can be a valid approach considering all factors. 🙂

0 Kudos
Message 30 of 34
(1,473 Views)