"ούτω γάρ ειδέναι το σύνθετον υπολαμβάνομεν, όταν ειδώμεν εκ τίνων και πόσων εστίν …"
25 Jan
function pstrickswrite2d(filename,data_matrix)
//Author: Panagiotis Chatzichrisafis
//Date: 25.01.2015
//Description:
//The function pstrickswrite2d(filename,data_matrix) has two inputs:
//: The path and the filename which shall be used to write
// formated output for PSTricks
//: The matrix containing the data to be written into the file provided by
// argument.
//The output written to the file has a format which is suitable for
//the TeX PSTricks package fileplot or dataplot commands.
_num_decimal_places_=5;
file_desc=file('open',filename,'unknown','formatted');
_max_num_ = max(abs(data_matrix));
_num_integer_digits_ = ceil(log10(_max_num_));
_num_format_(1) ='F';
// add number of integer digits and decimal digits plus 2 for sign information
_num_format_(2) = string(_num_integer_digits_+_num_decimal_places_+2);
_num_format_(3) ='.';
_num_format_(4) = string(_num_decimal_places_);
_num_format_ =strcat(_num_format_);
_format_(1) ='( ''{'' ' ;
_format_(2) = _num_format_;
_format_(3) = ', '','' ' ;
_format_(4) = _num_format_;
_format_(5) = ' ''}'' )' ;
_format_=strcat(_format_);
write(file_desc,data_matrix,_format_);
file('close',file_desc);
endfunction
and load it into the scilab workspace.
Leave a reply