Octave入门基础操作集合——Octave Tutorial Base/Basic operations

显示输出

>> a = 2
a =  2
>> display(a)
a =  2
>> disp(sprintf('2 decimals:%0.2f',a))
2 decimals:2.00

矩阵相关

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

   1   2
   3   4
   5   6

>> v=[1,2,3]
v =

   1   2   3

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

   1
   2
   3

>> v=1:6
v =

   1   2   3   4   5   6

>> ones(2,3)
ans =

   1   1   1
   1   1   1

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

   0.95899   0.12178   0.19698
>> w=rand(1,90);
>> hist(w)

Octave入门基础操作集合——Octave Tutorial Base/Basic operations_第1张图片

数据相关

>> who
Variables in the current scope:

A    I    a    ans  v    w
>> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        A           3x2                         48  double
        I           6x6                         48  double
        a           1x1                          8  double
        ans         1x14                        14  char
        v           1x6                         24  double
        w           1x90                       720  double

Total is 153 elements using 862 bytes

>> save hello.mat w
>> load hello.mat

你可能感兴趣的:(笔记,octave)