11-06-2011
Creating Matrix
Hi all, I'm a newbie in shell scripting and currently I'm trying to create a matrix using bash. The Output will look like this
AB CDE FG
1
2
3
4
5
6
7
I'm stuck on the ABCDEFG display.
printFlightSeats()
{
rows=7
columns=7
for ((i=0;i<=$rows;i++))
do
echo -n "$i" | tr "0" " "
for ((j=0;j<$columns;j++))
do
echo -n "$j" | tr "0" " " | tr "1234567" "ABCDEFG"
done
printf $j
printf "$i\n"
done
}
Can anyone advise me? Thanks in advance!
Moderator's Comments:
|
|
Double post, continued here
|
|
Last edited by pludi; 11-06-2011 at 06:25 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello, all!
I am struggling with a short script to read a diagonal matrix for later retrieval.
1.000 0.234 0.435 0.123 0.012 0.102 0.325 0.412 0.087 0.098
1.000 0.111 0.412 0.115 0.058 0.091 0.190 0.045 0.058
1.000 0.205 0.542 0.335 0.054 0.117 0.203 0.125
1.000 0.587 0.159 0.357... (11 Replies)
Discussion started by: yifangt
11 Replies
2. Shell Programming and Scripting
I need to create a large matrix so that I can feed that matrix to MATLAB for processing. The problem is creating that matrix because my data is completely scattered around files.
1. I have one big dictionary file which has words in newlines, like
apple
orange
pineapple
2. I have some... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
3. Ubuntu
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
Hi everyone
I am very new at awk but think that that might be the best strategy for this. I have a matrix very similar to a correlation matrix and in practical terms I need to convert it into a list containing the values from the matrix (one value per line) with the first field of the line (row... (5 Replies)
Discussion started by: stonemonkey
5 Replies
5. UNIX for Dummies Questions & Answers
I'm trying to create a Matrix using bash. The expected output is
.AB CDE FG
1
2
3
4
5
6
7
I'm a newbie in shell language, really appreciate if there is anyone who can guide me with this.
Double post again, continued here (0 Replies)
Discussion started by: vinzping
0 Replies
6. Shell Programming and Scripting
Hi all, I'm a newbie in shell scripting and currently I'm trying to create a matrix using bash. The Output will look like this
AB CDE FG
1
2
3
4
5
6
7
I'm stuck on the ABCDEFG display.
printFlightSeats()
{
rows=7
columns=7
for ((i=0;i<=$rows;i++))
do (2 Replies)
Discussion started by: vinzping
2 Replies
7. Shell Programming and Scripting
Dear all,
I'm new in perl scripting and I'm trying to creating a matrix from a 3 column file sorting data in a particular manner. In the final matrix I need to have the first column "IDs" on the header of the columns and the second column values on the header of each row. And the value fo the... (2 Replies)
Discussion started by: gabrysfe
2 Replies
8. Shell Programming and Scripting
Hello,
Greetings!
please help me produce the following solution. I need
to produce one big matrix file from several files in different levels.
If it helps, the index folder provides information on chromosome index and
the data folder provides information on values for chromosomes.
there... (8 Replies)
Discussion started by: newbie83
8 Replies
9. Programming
I want to create a Matrix template that uses vector. For the time being I want to create the following operations. I need setting the implementation for the operations.
Maybe I do not have to use a pointer either.
template <class T>
class Matrix {
protected:
typedef vector<T>* ... (2 Replies)
Discussion started by: kristinu
2 Replies
10. Shell Programming and Scripting
Hi
I do have a tab delimited file with 2 columns, which is stratified based on the first column. There are 1000's of values in the file.
Below is an example of the input file
1 AB
1 AC
1 CC
1 DD
2 AB
2 CC
2 AC
2 AB
3 CF
3 CC
3 DD
4 AC
4 CC
4 AD (5 Replies)
Discussion started by: Kanja
5 Replies
LEARN ABOUT HPUX
dtwsmchangebackdrop
DtWsmChangeBackdrop(API) DtWsmChangeBackdrop(API)
NAME
DtWsmChangeBackdrop -- set current workspace's backdrop
SYNOPSIS
#include <Dt/Wsm.h>
int DtWsmChangeBackdrop(
Display *display,
Window root,
char *path,
Pixmap pixmap);
DESCRIPTION
The DtWsmChangeBackdrop function works with the CDE workspace manager, dtwm(1), and changes the current workspace's backdrop. Applications
can use this function to implement an interface to the workspace manager.
If the DtWsmChangeBackdrop function is not successful, the most likely reason for failure is that the CDE workspace manager, dtwm(1), is
not running.
DtWsmChangeBackdrop sends a message to the CDE workspace manager, dtwm(1), to change the backdrop.
The path argument points to a backdrop file name. The file must be in either X Bitmap file format (with extension .bm) or Pixmap file for-
mat (with extension .pm). The workspace management services look for the file along the same path used for searching icons. The directory
/usr/dt/backdrops is the default directory if the file cannot be found along the icon search path.
ARGUMENTS
display display
root root window of the screen
path file path to bitmap file
pixmap pixmap ID of backdrop pixmap
SEE ALSO
DtWsm(5)
"Communicating with the Workspace Manager" section in the CDE Programmer's Guide
"Workspace Manager" section in the CDE Programmer's Overview
DtWsmChangeBackdrop(API)