1&&0 %AND
1 ||0 % OR
octave:6> PS1('>> ');
>>
octave:1> 5+6
ans =  11
octave:2> 1==2
ans = 0
octave:3> 1==2 %false %XXX %为注释
ans = 0
octave:4> 1~=2 %表示1不等于2
ans = 1
octave:5> xor(1,0) %异或
ans = 1
octave:6> PS1('>> '); %令提示符更精简
>> a =3
a =  3
>> a=3;%抑制打印输出
>> a =3
a =  3
>> a=3;
>> a
a =  3
>> b ='hids';
>> b
b = hids
>> c = (3>=1);
>> c
c = 1
>> a =pi;
>> a
a =  3.1416
>> disp(a);
 3.1416
>> disp(sprintf('2 decimals: %0.2f', a))
2 decimals: 3.14
>> disp('0.6f',a)
error: Invalid call to disp.  Correct usage is:

 -- disp (X)
 -- STR = disp (X)

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at https://www.octave.org and via the [email protected]
mailing list.
>> disp(sprintf('%0.6f',a))
3.141593
>> format long
>> a
a =  3.141592653589793
>> format short
>> a
a =  3.1416
>>
>> A = [1 2; 3 4; 5 6]
A =

   1   2
   3   4
   5   6

>> A = [1 2;
> 3 4;
> 4 5]
A =

   1   2
   3   4
   4   5

>> V =[1 2 3]
V =

   1   2   3

>> V =[1;2;3]
V =

   1
   2
   3
>> V = 1:0.1:2
V =

    1.0000    1.1000    1.2000    1.3000    1.4000    1.5000    1.6000    1.7000    1.8000    1.9000    2.0000

>> v = 1:6
v =

   1   2   3   4   5   6

>> ones(2,3)
ans =

   1   1   1
   1   1   1

>> C = 2*ones(2,3)
C =

   2   2   2
   2   2   2

>> C = [ 2 2 2;2 2 2]
C =

   2   2   2
   2   2   2

>> w = zeros(1,3)
w =

   0   0   0

>> w = ones(1,3)
w =

   1   1   1

>> w = rand(1,3)
w =

   0.42258   0.36123   0.84682

>> rand(3,3)
ans =

   0.6879706   0.0030582   0.5453437
   0.0901260   0.8243611   0.3456819
   0.8819444   0.2436181   0.0290983

>>
02-11 20:16