12-02-2009 03:42 PM
I got a file where I swap from displaying the data in rows into columns by using transpose 2D array. The problem now is, it now shows everything in one row. How do I break it into several rows?
From:
simplex-link duplex-link
n1 n0
n0 n0
10 10
20 20
DropTail DropTail
It should display:
simplex-link n1 n0 10 20 DropTail
duplex-link n0 n0 10 20 DropTail
But it gives me:
simplex-link n1 n0 10 20 DropTail duplex-link n0 n0 10 20 DropTail
Any advice where I did wrong?
Thanks 😄
Solved! Go to Solution.
12-02-2009 03:57 PM
12-02-2009 03:59 PM
Hi
I have LabVIEW 8.0 version. I try to understand your problem and make a new vi which reads all conc file.txt. I make vi which satisfied your requirement. You can have a look below imgaes
Thanks
Viru
12-02-2009 04:47 PM - edited 12-02-2009 04:48 PM
Based on the files posted, all you need it this:
12-02-2009 04:59 PM
12-02-2009 05:32 PM
I'm now trying to add more functions to Viru's solution
I'd like to add a constant at the beginning and somewhere in the middle of each row
What I got in mind so far is by using concatenate strings, concatenate the file and a constant then wire it to spreadsheet string to array , but it won't add the constant in each row; but instead, it only add at the first line
If I use loop, it still won't work right? As far as I understand, the file is read in a go, not line by line
instead of simplex-link n4 n3 10 20 DropTail, I'd like to do:
$ns simplex-link $n4 $n3 10Mb 20ms DropTail
12-03-2009 07:39 AM
Hi
I try to make a vi according to your requirement. I hope it works for you.
Please check the attachment.
12-03-2009 11:10 AM
Thanks 😄
The only thing is that, it will loop for 6x6 which gives out 4 concatenation without the data from the file (only $ns $ $..)
But I got around it by wiring the first for loop to a.txt (where it has n0, n1 - so it's read as 2x1) ; which ends up will loop only 2 times at the first for loop
I'm not sure if I'm making any sense here, but what I'm doing is, I have a file called a.txt which list out only n0, n1, another file, b.txt which only list out simplex-link, duplex-link etc. I then concatenate all the files giving me
simplex-link n0
duplex-link n1
then I do another concatenation as Viru pointed out giving me $ns simplex-link $n0 etc
Is there another way that I could try so that the first for loop would only loop according to the column number, not row without reading the number of row in another file?