Please keep this on the list so that all can benefit. -----Original Message----- From: Antonio Jose [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 1:35 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: A big trouble
Hello.... I have 3 weeks learning Perl and I am trying to solve a trouble I need to write my thesis.... I have to read a file where I don't know the content of the first rows (only strings) and I need to read only data (numbers), I mean, I am going to read information that begin with blank spaces and numbers, from there, I have a matrix of 7 columns and n rows (I don't know the exact numbers of rows), the column 1 correspond to depth and the next 6 columns correspond to variables in each depth. But there are cases where I have missing values, represented by -999.25, in this cases I have to create a couple of columns; one of them correponding to the variable without the missing value and teh other one with the corresponding depth. At the end, I will work with matrices of 2 columns (depth and variable), called, for example, @rt (variable) and @prof_rt (depth). I write a subroutine called "guardar" whose parameters are the vector of depth without missing values, the vector of the variable without missing values, the vector of the initial variable (with missing values), a scalar ($p) that indicate the number of the column (variable) I am working on and a scalar ($long) that indicate the length of the vector depth without missing values (I could obviate the last two parameters but I don't know how to do it). The objective of this subroutine is print in other file columns already mencioned (prof_obj, variable, variable without missing values) and other column (@intens) obtained by a processing done in other sub explained down. This process is executed for each value of prof_obj and this is included in a loop for. On the other hand, the subroutine "suavizar" do the calculus of @intens; it takes each value of prof_obj inserted in the sub "guardar" and compare it with prof_val (depth related to a variable without missing values) divided by a constant $b, all this is accumulated in $denominador, previously executed the subroutine "kernel" (explained down), all this is realized for each element of prof_val (called $long and inserted as parameter). In the same way a calculus will be accumulated in $numerador where the value of the sub "kernel" is multiplied by the value of the variable without missing value. At the end I will obtain a quotient. In addition to, the subroutine "kernel" only do a simple mathematical calculus and gives a number to "suavizar". I think I have troubles to read $long or parameters from other sub's, there is a ilegal division of numerador/denomimador because there aren't something assigned to them. I have checked some web pages and it's difficult to find examples like this where there is manipulations of matrices or sub's inside others sub's. I attach the script if you would like to read and correct. Sorry for my english and thanks a lot!! Toni
columnas1.pl
Description: Binary data
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]