Skip to main content
17-Peridot
Jan 19, 2012 2:33 PM UTC
Solved

READCSV peculiar feature

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

RichardJAnswer
19-Tanzanite
Jan 19, 2012 4:16 PM UTC

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

15 replies

1-Visitor
Jan 19, 2012 2:43 PM UTC

Raiko,

Could you attach the Mathcad worksheet?

Mike

Translate
1-Visitor
Jan 19, 2012 2:54 PM UTC

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

Translate
Raiko17-PeridotAuthor
17-Peridot
Jan 19, 2012 3:03 PM UTC

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

Translate
RichardJ19-TanzaniteAnswer
19-Tanzanite
Jan 19, 2012 4:16 PM UTC

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

Translate
1-Visitor
Jan 19, 2012 6:53 PM UTC

#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

Translate
1-Visitor
Jan 26, 2012 12:14 PM UTC

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

Translate
Raiko17-PeridotAuthor
17-Peridot
Jan 26, 2012 12:39 PM UTC

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

Translate
1-Visitor
Jan 26, 2012 12:44 PM UTC

Yes, the file I posted will read a CSV file me cell A1.

Mike

Translate