I need help in understanding how to use this octave script
http://www.gnuplotting.org/code/save_binary_matrix.m
to generate a binary matrix that I want to plot with gnuplot. Any suggestion will be appreciated even just a web link that would help me to understand octave syntax
thanks
Mariano
Octave syntax
The octave syntax is not that hard to understand. The documentation of the interpreter can be found here.
The main part of the script
can be explained like this:
Line 1 initializes a matrix
MSof dimensionslength(x) + 1andlength(y) + 1wherelengthdetermines the largest dimension of the argument. Sincexandyare in your case vectors,lengthreturns the dimension of the vector.After in Line 1 the matrix
MSis created, the length of vectorxis stored inMS(1,1). This is the first row element of the first column ofMS.Line 3 assigns the rest of the first row (everything from the 2nd element to the end: hence
2:endthe values ofy.The rest of the first column gets all the values of
xassigned to.The remaining matrix
MSnow gets all values of the transpose ofMassigned.You basically end up with a matrix that has the y-axis stored in the first row and the x-axis stored in the first column. The remaining matrix
MSholds the transpose of matrixM.Plotting a binary matrix with gnuplot
As described here the format specified above is of the exact format as needed by gnuplot. You now have multiple ways of plotting matrix information. One simple way of testing your binary file is
where
"Data.bin"has to be substituted for your binary file.A general introduction into plotting 3D information can be found here and there.