Octave第二天
size()
length()
读入数据
load xx.dat或者load()
who 查看现在内存里的变量
矩阵操作
A = [1 2;3 4;5 6]
size(A)
size(A,1)
size(A,2)
length(A)
%pwd
%load featuresX.dat
%load price
%who
%whos
%clear()
%save hello.mat A
%save hello.txt A -ascii
A([1 3], : )
A(:,[100;101;102])
C = [A B]
C = [A;B]
运算操作
A = [1 2;3 4;5 6]
B = [11 12;13 14;15 16]
C = [1 1;2 2;3 3]
V = [1;2;3]
A * C
A .* B
A .^ 2
1 ./ V
log(v)
exp(v)
abs(v)
v + ones(3,1)
v + 1
A’%转置
a = [1 15 2 0.5]
val = max(a)
[val, ind] = max(a)
a < 3
magic(3)
%help magic
[r,c] = find(A >= 7)
sum(a)
prod(a)
floor(a)
ceil(a)
rand(3)
max(rand(3),rand(3))
max(A,[],1)
max(A,[],2)
max(max(A))
A( : )
sum(A,1)
sum(A,2)
A.*eye(9)
sum(sum(A.*eye(9)))
flipud()
pinv(A) * A