Wednesday, 9 August 2017

octave learning note

length will return the longest dimension's size.

load can load data files . cvs kind of data files

who will list all variables in RAM.

whos will list variables detail info

clear function will remove a variables from RAM

if you just type "clear", it will clean everything.

get first 10 items from priceY (an existing var) and create a new var -- V

save filename variablename will save the variable into a file.

You can save with -ascii which will make the file readable (not binary)

But I found both readable (at least both readable for small files, it may compress for large files)

above is tell us about indexing. how to access elements in the matrix

a(3,2) will return the element value of row 3 column 2 which is the last element ---6

  ":" means everything . a(2,:)  will return row 2 .  a(:,2) will return column 2

you also can use this to set values:
a(3,2) = 100 will change the last element.
a(:,2) = [8;9;10] will change the second column , it will change the whole column. (we need to give vector because a(:,2) is a vector)

change all data into a vector

connect two matrixes

connect two matrixes

connect two matrixes

"," or " " will put the second matrix on to the right of the first one.
";" will put it below

No comments:

Post a comment