summaryrefslogtreecommitdiff
path: root/1088/CH2/EX2.2/Example2.sce
blob: 95ba75114949f14db61619984f7b2d2f0bd24f23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//Program for example 2 chapter 2
clear
clc

disp("Example 2: Display the type of a given variable or a command ")
disp('')
printf("\n*******************************************************************\n")
disp("Answer   :")
printf("THE FOLLOWING LINES OF CODE RUN \nONLY IN SCILAB INSTALLED IN UNIX ENVIRONMENT.....")
printf("\nTHE CONSOLE GIVES DIFFERENT \nOUTPUT IN OTHER OPERATING SYSTEMS")
if(getos() ~= "Linux" )then
   ctd=input("Enter the command or variable whose type is to be determined  ")
   clc(1)
   pt = input("Enter the command again to confirm  ","s")
   clc(1)
    printf("Continue?....\ny :Yes\nAny other key:No")
    st = input('','s')
    clc(2)
    if( st ~= "y") then
        exit
    else
        n=type(ctd)
        clc(1)
        printf("%s is a ",pt)
        select n
case            1 then
printf("a real or complex matrix of double.")

case            2 then
printf('a polynomial matrix.')
case           4 then
printf('a boolean matrix.')
case           5 then
printf('a sparse matrix.')

case 6 then
printf('a sparse boolean matrix.')

case 7 then
printf('Matlab sparse matrix')
case 8 then
printf('a matrix of integers stored on 1 (int8), 2 (int16) or 4 (int32) bytes.')
case 9 then
printf('a matrix of graphic handles.')
case 10 then
printf('a matrix of character strings.')
case 11 then
printf('an un-compiled function . A function created with deff with argument [n].')
case 13 then
printf('a compiled function .')
case 14 then
printf('a function library.')
case 15 then
printf('a list.')
case 16 then
printf('a typed list (tlist).')
case 17 then
printf('a matrix oriented typed list (mlist).')
case 128 then
printf('a pointer (Use case: lufact).')
case 129 then
printf('a size implicit polynomial used for indexing.')
case 130 then
printf('a built-in Scilab function, called also gateway (C, C++ or Fortran code).')
case 0 then
printf('a null variable. It is mainly used internally by Scilab. If a function has no declared returned argument like disp when it is called it returns a null variable. If a function is called with an omitted argument in the argument list like foo(a,,b) the missing argument is assigned to a null variable.')

        end
        end
else
    disp("Enter the file whose type is to be found")
    unix_w('read xtun;type $xtun')
end
printf("\n*******************************************************************\n")