Skip to main content
17-Peridot
January 19, 2012
Solved

READCSV peculiar feature

  • January 19, 2012
  • 15 replies
  • 7426 views

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

Best answer by RichardJ

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
January 19, 2012

Raiko,

Could you attach the Mathcad worksheet?

Mike

1-Visitor
January 19, 2012

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

Raiko17-PeridotAuthor
17-Peridot
January 19, 2012

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

RichardJ19-TanzaniteAnswer
19-Tanzanite
January 19, 2012

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-Visitor
January 19, 2012

#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

1-Visitor
January 26, 2012

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

Raiko17-PeridotAuthor
17-Peridot
January 26, 2012

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

1-Visitor
January 26, 2012

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

Mike