Column: Text to Columns...
Split a single column of text into multiple columns.
See LabTalk Supported Functions for CatIndex, and Catrows.
text2cols ix:=[Book2]Sheet1!B delimiter:=pipe; // take pipe-separated strings in [Book2]Sheet1!B as input, output values to separate columns in new sheet
Please refer to the page for additional option switches when accessing the x-function from script
This X-Function takes a cell or column of delimited text and parses it to new columns.
This example imports an ASCII file containing categorical data, uses the catrows()$ function to obtain row indices for each category, then outputs those row indices to new columns. The resulting sheet text2cols lists row indices for each category.
// create an empty book and import the file automobile.dat into the new book newbook; string fname$= system.path.program$ + "Samples\Statistics\automobile.dat"; impASC; // set column 2 as categorical and sort it in ascending order wks.col2.categorical.type=2; wks.col2.categorical.sort=1; // get column 2 into range variable rA range rA = [automobile]automobile!"Make"; // create a new book and use category function to copy categories in rA to column A of newbook // to column B, add row indices of occurrence for each category, as a pipe-separated list newbook; col(A)=category(rA)$; col(B)=catrows(rA)$; // taking pipe-separated strings in [Book2]Sheet1!B as input, output values to new sheet in <input>. text2cols ix:=[Book2]Sheet1!B delimiter:=pipe nosplit:=1 other:=[Book2]Sheet1!A;
wxcat