Sponsored Content
Top Forums Shell Programming and Scripting How to convert 2 columns into matrix -awk? Post 302942951 by RudiC on Monday 4th of May 2015 08:07:31 AM
Old 05-04-2015
Works perfectly for me. Try increasing the %10s format string.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

convert matrix to row and columns

Dear Unix Gurus, I have a sample data set that looks like this y1 y2 y3 y4 y5 x1 0.3 0.5 2.3 3.1 5.1 x2 1.2 4.1 3.5 1.7 1.2 x3 3.1 2.1 1.0 4.1 2.1 x4 5.0 4.0 6.0 7.0 1.1 I want to open it up so that I get x1 y1 0.3 x2 y1 1.2 x3 y1 3.1 x4 y1 5.0 x1 y2 0.5 x2 y2... (3 Replies)
Discussion started by: tintin72
3 Replies

2. UNIX for Dummies Questions & Answers

Convert rows to columns using AWK

Hi , I am struck while coding AWK script. Need your help to convert rows into columns. I should copy only those rows which are marked to Y in a file and ignore N rows. Please help me find a solution. input file 1|abc|Y 2|cdf|Y 3|efg|N 4|xyz|Y my output should be something like this... (2 Replies)
Discussion started by: rashmisb
2 Replies

3. Ubuntu

How to convert full data matrix to linearised left data matrix?

Hi all, Is there a way to convert full data matrix to linearised left data matrix? e.g full data matrix Bh1 Bh2 Bh3 Bh4 Bh5 Bh6 Bh7 Bh1 0 0.241058 0.236129 0.244397 0.237479 0.240767 0.245245 Bh2 0.241058 0 0.240594 0.241931 0.241975 ... (8 Replies)
Discussion started by: evoll
8 Replies

4. Shell Programming and Scripting

convert data into matrix- awk

is it possible to count the number of keys based on state and cell and output it as a simple matrix. Ex: cell1-state1 has 2 keys cell3-state1 has 4 keys. Note: Insert 0 if no data available. input key states cell key1 state1 cell1 key1 state2 cell1 key1 ... (21 Replies)
Discussion started by: quincyjones
21 Replies

5. Shell Programming and Scripting

Convert columns to row using awk

Hi I need to convert some columns form a html file to rows. I do manage to make it works without help (some proud :) ) For some reason the offline status is not in bold, so I do need to remove the <b> tag from the other field to make this to work. All fields are not needed, so I test and... (5 Replies)
Discussion started by: Jotne
5 Replies

6. UNIX for Dummies Questions & Answers

Convert nxm Matrix into columns of data

Dear Unixers, I'm having some difficulty in converting an n x m data matrix into a dataset of 3 columns and nxm rows. As an example I want to convert this dataset 2 3 4 5 2 0.0 0.0 0.1 0.1 6 -0.3 2.0 0.0 0.3 7 -0.6 -1.1 0.5 0.3 9 -0.9 -4.1 -0.7 0.5 ... (2 Replies)
Discussion started by: tintin72
2 Replies

7. Shell Programming and Scripting

awk to convert table-by-row to matrix table

Hello, I need some help to reformat this table-by-row to matrix? infile: site1 A:o,p,q,r,s,t site1 C:y,u site1 T:v,w site1 -:x,z site2 A:p,r,t,v,w,z site2 C:u,y site2 G:q,s site2 -:o,x site3 A:o,q,s,t,u,z site3 C:y site3 T:v,w,x site3 -:p,routfile: SITE o p q r s t v u w x y... (7 Replies)
Discussion started by: yifangt
7 Replies

8. Shell Programming and Scripting

Calculate percentage of columns greater than certain value in a matrix using awk

This matrix represents correlation values. Is it possible to calculate the percentage of columns (a1, a2, a3) that have a value >= |0.5| and report the percentage that has positive correlation >0.5 and negative correlation <-0.5 separately. thanx in advance! input name a1 a2 a3... (5 Replies)
Discussion started by: quincyjones
5 Replies
Math(3) 						User Contributed Perl Documentation						   Math(3)

NAME
PDL::Math - extended mathematical operations and special functions SYNOPSIS
use PDL::Math; use PDL::Graphics::TriD; imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)]; DESCRIPTION
This module extends PDL with more advanced mathematical functions than provided by standard Perl. All the functions have one input pdl, and one output, unless otherwise stated. The functions are usually available from the system maths library, however if they are not (determined when PDL is compiled) a version from the Cephes math library is used. FUNCTIONS
acos Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. asin Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. atan Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. cosh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. sinh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. tan Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. tanh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. ceil Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. floor Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. rint Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. pow Signature: (a(); b(); [o]c()) Synonym for `**'. Works inplace. acosh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. asinh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. atanh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. erf Signature: (a(); [o]b()) The error function. Works inplace. erfc Signature: (a(); [o]b()) The complement of the error function. Works inplace. bessj0 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessj1 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessy0 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessy1 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessjn Signature: (a(); int n(); [o]b()) The standard Bessel function. This has a second integer argument which gives the order of the function required. Works inplace. bessyn Signature: (a(); int n(); [o]b()) The standard Bessel function. This has a second integer argument which gives the order of the function required. Works inplace. lgamma Signature: (a(); [o]b(); int[o]s()) log gamma function This returns 2 piddles -- the first set gives the log(gamma) values, while the second set, of integer values, gives the sign of the gamma function. This is useful for determining factorials, amongst other things. badmask Signature: (a(); b(); [o]c()) Clears all "infs" and "nans" in $a to the corresponding value in $b. badmask can be run with $a inplace: badmask($a->inplace,0); $a->inplace->badmask(0); isfinite Signature: (a(); int [o]mask()) Sets $mask true if $a is not a "NaN" or "inf" (either positive or negative). Works inplace. erfi Signature: (a(); [o]b()) The inverse of the error function. Works inplace. ndtri Signature: (a(); [o]b()) The value for which the area under the Gaussian probability density function (integrated from minus infinity) is equal to the argument (cf erfi). Works inplace. svd Signature: (a(n,m); [o]u(n,m); [o,phys]z(n); [o]v(n,n)) Singular value decomposition of array. ($u, $s, $v) = svd($a); polyroots Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m)) Complex roots of a complex polynomial, given coefficients in order of decreasing powers. ($rr, $ri) = polyroots($cr, $ci); eigens Signature: ([phys]a(m); [o,phys]ev(n,n); [o,phys]e(n)) Eigenvalues and -vectors of a symmetric square matrix. If passed an asymmetric matrix, the routine will warn and symmetrize it. ($e, $ev) = eigens($a); simq Signature: ([phys]a(n,n); [phys]b(n); [o,phys]x(n); int [o,phys]ips(n); int flag) Solution of simultaneous linear equations, "a x = b". $a is an "n x n" matrix (i.e., a vector of length "n*n"), stored row-wise: that is, "a(i,j) = a[ij]", where "ij = i*n + j". While this is the transpose of the normal column-wise storage, this corresponds to normal PDL usage. The contents of matrix a may be altered (but may be required for subsequent calls with flag = -1). $b, $x, $ips are vectors of length "n". Set "flag=0" to solve. Set "flag=-1" to do a new back substitution for different $b vector using the same a matrix previously reduced when "flag=0" (the $ips vector generated in the previous solution is also required). squaretotri Signature: (a(n,n); b(m)) Convert a symmetric square matrix to triangular vector storage BUGS
Hasn't been tested on all platforms to ensure Cephes versions are picked up automatically and used correctly. AUTHOR
Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka (Tuomas.Lukka@hel- sinki.fi). All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2003-01-29 Math(3)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy