|
Contents | Previous | Next | Subchapters |
| Syntax |
ncols(file, matrix type) |
| See Also | nrows , read , readh |
temp.dat that contains the text
1 2 3
4 5
by entering the following commands
clear
file = "temp.dat"
rmfile(file);
write(file, "1 2 3")
write(file, "4 5")
close(file)
If you then enter
ncols("temp.dat", "int")
O-Matrix will respond
{
3
2
}
because temp.dat has three integers in its first row and
two in its second row.
If you continue by entering
ncols("temp.dat", "char")
O-Matrix will respond
{
5
3
}
because temp.dat
has five characters in its first row and three in its second row
(there is one space between each of the numbers).
...),
ncols will not count the following line separately,
(characters from the ellipsis up to and including the next new line
are replaced by a single space).
You can create a file called temp.dat that contains the text
1 2 3 ...
4 5
6 7 8 ...
9 10
by entering the following commands
clear
file = "temp.dat"
rmfile(file);
write(file, "1 2 3 ...")
write(file, "4 5")
write(file, "6 7 8 ...")
write(file, "9 10")
If you then enter
ncols("temp.dat", "int")
O-Matrix will respond
{
5
5
}
The matrix type "byte" is the same as "char" but the interpretation of
the ellipsis is suppressed.
If you continue by entering
ncols("temp.dat", "byte")
O-Matrix will respond
{
9
3
9
4
}