Documentation Center

  • Trial Software
  • Product Updates

wk1read

Read Lotus 1-2-3 WK1 spreadsheet file into matrix

    Note:   wk1read has been removed.

Syntax

M = wk1read(filename)
M = wk1read(filename,r,c)
M = wk1read(filename,r,c,range)

Description

M = wk1read(filename) reads a Lotus1-2-3 WK1 spreadsheet file into the matrix M. The filename input is a string enclosed in single quotes.

M = wk1read(filename,r,c) starts reading at the row-column cell offset specified by (r,c). r and c are zero based so that r=0, c=0 specifies the first value in the file.

M = wk1read(filename,r,c,range) reads the range of values specified by the parameter range, where range can be

  • A four-element vector specifying the cell range in the format

    [upper_left_row upper_left_col lower_right_row lower_right_col]

  • A cell range specified as a string, for example, 'A1...C5'

  • A named range specified as a string, for example, 'Sales'

Examples

Create a 8-by-8 matrix A and export it to Lotus spreadsheet matA.wk1:

A = [1:8; 11:18; 21:28; 31:38; 41:48; 51:58; 61:68; 71:78]
A =
     1     2     3     4     5     6     7     8
    11    12    13    14    15    16    17    18
    21    22    23    24    25    26    27    28
    31    32    33    34    35    36    37    38
    41    42    43    44    45    46    47    48
    51    52    53    54    55    56    57    58
    61    62    63    64    65    66    67    68
    71    72    73    74    75    76    77    78

wk1write('matA.wk1', A);

To read in a limited block of the spreadsheet data, specify the upper left row and column of the block using zero-based indexing:

M = wk1read('matA.wk1', 3, 2)
M =
    33    34    35    36    37    38
    43    44    45    46    47    48
    53    54    55    56    57    58
    63    64    65    66    67    68
    73    74    75    76    77    78

To select a more restricted block of data, you can specify both the upper left and lower right corners of the block you want imported. Read in a range of values from row 4, column 3 (defining the upper left corner) to row 6, column 6 (defining the lower right corner). Note that, unlike the second and third arguments, the range argument [4 3 6 6] is one-based:

M = wk1read('matA.wk1', 3, 2, [4 3 6 6])
M =
    33    34    35    36
    43    44    45    46
    53    54    55    56

See Also

Was this topic helpful?