Hello all,
I stumbled across a peculiar problem when reading in CSV files. I'm using MC-15 on a 64 bit Win7 machine.
The file in question (attached) is a CSV file with eleven columns of measurement data. The timeline is in the very first columns (see pic). READCSV refuses to read in a column that is given as column 0 (must be a positive integer). When giving a 1 as first column to read in it attaches the first column (my timeline) at the end of the array (see MC array Y).
This behaviour is peculiar as I didn't find anything in the help section.
Does anybody know whether:
#1 Is there a work around so I can use a normal column definition (0 for first column etc.)?
#2 If not possible. Is this MC behaviour reliable? Will the first (0) column always be attached at the end?
#3 Did I miss something when giving the definitions for READCSV?
Thanks in advance
Raiko
Solved! Go to Solution.
Well, that's obviously a bug.
#1 Is there a work around so I can use a normal column definition (0 for first column etc.)?
I don't think so (except to read the file using a scripted component, and thereby bypass the bug completely)
.
#2 If not possible. Is this MC behaviour reliable? Will the first (0) column always be attached at the end?
I assume so. Until they fix the bug, anyway, so it will probably work that way for at least a decade
Raiko,
Could you attach the Mathcad worksheet?
Mike
I see what you mean now. The READCSV rows and cols are indexes that start with 1 and cannot be changed. I found a workaround by inserting a column before the data and moving all the data to the right.
Mike
I forgot to add - I presume this data is being produced by another piece of software. Can you change the format from CSV to a Excel worksheet?
Message was edited by: Mike Armstrong
Hello Mike,
thank you for your response.
Neat idea to add an extra column. Annoying but it does the trick. Though, a bit less annoying than importing CSV files to Excel.
Raiko
P.S.
Just in case. Here is the MC file
Neat idea to add an extra column. Annoying but it does the trick. Though, a bit less annoying than importing CSV files to Excel.
I find it very strange that it can't read a CSV file with rows and columns denoted as zero.
Can the data not be exported in any other format?
Mike
I have just been playing around with the Excel worksheet and reading it in and there seems to be a bug.
Try deleting A1:D18 and reading the first column data in. It works for me, see below.
Modified Excel sheet below and also attached.
Mike
Well, that's obviously a bug.
#1 Is there a work around so I can use a normal column definition (0 for first column etc.)?
I don't think so (except to read the file using a scripted component, and thereby bypass the bug completely)
.
#2 If not possible. Is this MC behaviour reliable? Will the first (0) column always be attached at the end?
I assume so. Until they fix the bug, anyway, so it will probably work that way for at least a decade
#1 Is there a work around so I can use a normal column definition (0 for first column etc.)?
I don't think so (except to read the file using a scripted component, and thereby bypass the bug completely)
There is a workaround but it requires the user to modify the CSV file.
Mike
Just been thinking about your problem. Why don't you use one of the scripted components what have been written to read excel worksheet as a work around.
Mike
Mike, I'd love to, but the sheets are delivered as CSV files to me. So my workaround is to import the CSV into Excel (which is cumbersome) and then I use the Excel read in features.
Annoying, but it works
Raiko
Yes, the file I posted will read a CSV file me cell A1.
Mike
Raiko,
Did you get this sorted?
Mike
Hello Mike,
well kind of. I got a student who did the conversion work (CSV import in Excel) for me, so I could get on with my work.
Raiko
Did the scripted component I posted not work?
I have managed to read the correct data with it. I'm using M15 and office 2007 btw.
Mike
No, for some reason it (Win 7, 64 bit) moans that it doesn't support the GetObject method. I suppose that some dll is missing when my machine was set up new two weeks ago.
Raiko
Oh dear,
I haven't had the pleasure of converting to Windows 7 yet.
Mike