RaviPaike Posted January 27, 2005 Report Share Posted January 27, 2005 I am reading a csv file using read file Vi but the problem i am facing is the out put of that vi is a multinline string but i don't know how to convert this multiline string in to array. have anybody of you tried this Thanks Quote Link to comment
Jim Kring Posted January 27, 2005 Report Share Posted January 27, 2005 I am reading a csv file using read file Vi but the problem i am facing is the out put of that vi is a multinline string but i don't know how to convert this multiline string in to array. have anybody of you tried this Thanks 3690[/snapback] The "oglib_string" library which you can obtain using OpenG Commander has a VI called "Multiline string to Array". Quote Link to comment
skywalkerxp Posted January 28, 2005 Report Share Posted January 28, 2005 this may help Cheers Qia Quote Link to comment
RaviPaike Posted January 28, 2005 Author Report Share Posted January 28, 2005 The "oglib_string" library which you can obtain using OpenG Commander has a VI called "Multiline string to Array". 3692[/snapback] hey Thanks Jim. dude u rock !! Quote Link to comment
aledain Posted January 31, 2005 Report Share Posted January 31, 2005 I am reading a csv file using read file Vi but the problem i am facing is the out put of that vi is a multinline string but i don't know how to convert this multiline string in to array. 3690[/snapback] Or to KISS, try ... Quote Link to comment
Michael Aivaliotis Posted February 2, 2005 Report Share Posted February 2, 2005 Or to KISS, try ... 3710[/snapback] I don't mean to correct you Alex but I think you would need to specify a comma for a delimeter, no? Quote Link to comment
Jim Kring Posted February 2, 2005 Report Share Posted February 2, 2005 I don't mean to correct you Alex but I think you would need to specify a comma for a delimeter, no? 3730[/snapback] No, because because the delimiter is an EOL character (each line in the string becomes and array element). However, that code has a couple small issues: 1) the LabVIEW "End of Line Constant" changes depending on platform (Windows EOL = CRLF, Mac EOL = CR, Linux EOL = LF), which may not give consistent results for the same input string. 2) the code does not handle strings with mixed EOL characters While the OpenG version of "Multiline String to Array" does not exactly keep it simple (if you feel the need to look at the code), it does handle any combination of mixed EOL characters. It does this by first replacing all instances of CRLF with LF and then replacing all instances of CR with LF and then using a LF delimiter to convert the string to an array. hey Thanks Jim. 3696[/snapback] You're welcome Quote Link to comment
aledain Posted February 3, 2005 Report Share Posted February 3, 2005 Yes, I know I should have said: to avoid the need to install/download OpenG(1), and if you don't need/want OS independent code, and you're not interested in mixed EOL characters, and, and, and, ... but I thought I had covered that with "smooch" 1. although you should've done this as the first step after purchasing LV, IMHO. P.S. Michael, I will always welcome corrections! That's how you learn! In this case however, the code was just using the tool with the EOL as delimter as a quick solution. Quote Link to comment
Michael Aivaliotis Posted February 3, 2005 Report Share Posted February 3, 2005 Yes, I know I should have said: to avoid the need to install/download OpenG(1), and if you don't need/want OS independent code, and you're not interested in mixed EOL characters, and, and, and, ... but I thought I had covered that with "smooch" 1. although you should've done this as the first step after purchasing LV, IMHO. P.S. Michael, I will always welcome corrections! That's how you learn! In this case however, the code was just using the tool with the EOL as delimter as a quick solution. 3753[/snapback] Ok guys. I have an issue with this implementation with respect to showing new users how to do things. I now understand what you are trying to show Alex but the "proper" conversion of a CSV file to an array would go something like this: Let's not forget that the original question was asking about a CSV (comma separated values) string. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.