The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"[SOLVED] Importing: text with fixed length attributes"
Hello,
I have looked through the import components and Googled but cannot find a way to
read in a simple text file with fixed length attributes. How can one do this?
Apologies if this is a "no brainer" but I could not find a simple direct way to do this.
TIA,
Hugo
I have looked through the import components and Googled but cannot find a way to
read in a simple text file with fixed length attributes. How can one do this?
Apologies if this is a "no brainer" but I could not find a simple direct way to do this.
TIA,
Hugo
Tagged:
0
Answers
You probably need the "Read CSV" operator. This operator can read a structured data set from a text file. Use the wizard to import and configure this operator correctly. For instance it is important to specify the separator so the operator knows where the value for an attribute begins and stops.
Best regards
Marcin
I already had a look at the CSV reader but it requires the use of a delimiter.
The file I have has no such delimiters. As an example, assume I have a line:
AABBCCCC
In this case I have 3 attributes with lengths 2, 2 and 3 respectively.
The attribute value would be AA, BB and CCCC. Note that no separator
exists.
Write now I am preparing AWK scripts to deal with this but I assumed
Rapidminer can deal with this type of data easily.
Thanks for the feedback.
You could read the text file using the regular expression "\r\n" to read each complete line.
Then use the operator Generate Extract to split each line into the required components using regular expressions.
Here's an example The text file contains this and the result looks like this regards
Andrew
Exactly what I was looking for.
Thank you.
Hugo F.