Sponsored Content
Full Discussion: Applying filters
Top Forums Programming Applying filters Post 302494856 by durden_tyler on Tuesday 8th of February 2011 04:17:49 PM
Old 02-08-2011
Notice how the values of DIST(i) can be assigned alternatively -

Code:
DIST(1) = X - 4 * DX     = X + (-5 + 1) * DX
DIST(2) = X - 3 * DX     = X + (-5 + 2) * DX
DIST(3) = X - 2 * DX     = X + (-5 + 3) * DX
DIST(4) = X - DX         = X + (-5 + 4) * DX
DIST(5) = X              = X + (-5 + 5) * DX
DIST(6) = X + DX         = X + (-5 + 6) * DX
DIST(7) = X + 2 * DX     = X + (-5 + 7) * DX
DIST(8) = X + 3 * DX     = X + (-5 + 8) * DX
DIST(9) = X + 4 * DX     = X + (-5 + 9) * DX

Quote:
Originally Posted by kristinu
I have a value X, a value DX and an odd integer N (say N=9) and want to create an array such that
Code:
let X = 10, DX = 2 and N = 9
...

How can I do a loop to do this?
...
Assuming you want to use X, DX, N and DIST in your loop construct, you could do something like this -

Code:
for( i = 1; i <= N; i++ )
{
  DIST[i] = X + (-5 + i) * DX
}

tyler_durden
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

IP Filters

Anyone know where I can find good documentation for IPF on the Internet? Thanks, Chuck (1 Reply)
Discussion started by: 98_1LE
1 Replies

2. Solaris

Solaris lp printer filters

I don't have much experience with solaris printers. I've created a printer using lpadmin. When I tried to print something, I got a message that there a no filters on the server. I went to docs.sun.com and got a script to add a filter (below) for filter in *.fd;do >name=`basename $filter... (1 Reply)
Discussion started by: soliberus
1 Replies

3. UNIX for Dummies Questions & Answers

How can I use filters to extract infos?

I encountered some complicated problems course studies. take this for example: under /home/data/stockdata we have 1999,2000,2001,.......2004 these sub-dirs and, each sub-dir has its mothly(for Jan~Dec) transaction records, i.e. they are all named "foo.txt", like this: Date ... (2 Replies)
Discussion started by: virii
2 Replies

4. UNIX for Dummies Questions & Answers

filters

how to filter one particular row from one text file and copy it in another? (1 Reply)
Discussion started by: rajanandhini
1 Replies

5. UNIX for Dummies Questions & Answers

Difference between filters of ps

Hi I am a newbie to Unix . I am just trying to understand the difference between various filters for ps. Can someoen pelase explain me whta is the difference between using /usr/bin/ps -ef | grep <PID> or <Process name> and /usr/bin/ps -auxwww| grep <PID> or <Process Name>. (1 Reply)
Discussion started by: sillybirdie123
1 Replies

6. UNIX for Advanced & Expert Users

Unix- filters ppt

Hello.. i want a ppt on unix filters.. can anybody gv me d link 4 that?? (1 Reply)
Discussion started by: shweta_babbar
1 Replies

7. Shell Programming and Scripting

Need help in filters

Hi, I have input data. 9214919702; B5; 1;20070216; 9231590437; BY; 1;20070215;9;20091022;12;20091022; 9211765888; AZ; 1;20080802;1;20080802;14;20091027; 9231592590; BY; 1;20070215;9;20091026;9;20091026; 9252412219; MM; 1;20070217; 9214917135; MM; 1;20070215; 9214917056; B5; 1;20070215;... (8 Replies)
Discussion started by: suresh3566
8 Replies

8. UNIX for Dummies Questions & Answers

Applying awk

I have a file that is formatted like this: ======== aaaa 11111 bbbb 2222 cccc 3333 ============ dddd 4444 eeee 5555 ffff 6666 ============ trying to get the file to look like this: ====== aaaa aaaa 1111 aaaa bbbb 2222 aaaa cccc 3333 ============= dddd dddd 4444 dddd... (2 Replies)
Discussion started by: jimmyf
2 Replies
mdbFontSize(5)							 The m17n Library						    mdbFontSize(5)

NAME
mdbFontSize - Font Size DESCRIPTION
In some case, a font contains incorrect information about its size (typically in the case of a hacked TrueType font), which results in a bad text layout when such a font is used in combination with the other fonts. To overcome this problem, the m17n library loads information about font-size adjustment from the m17n database by the tags <font, resize>. The data is loaded as a plist of this format. FONT-SIZE-ADJUSTMENT ::= PER-FONT * PER-FONT ::= '(' FONT-SPEC ADJUST-RATIO ')' FONT-SPEC ::= '(' [ FOUNDRY FAMILY [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ]]]]] REGISTRY ')' ADJUST-RATIO ::= INTEGER FONT-SPEC is to specify properties of a font. FOUNDRY to REGISTRY are symbols corresponding to Mfoundry to Mregistry property of a font. See m17nFont for the meaning of each property. ADJUST-RATIO is an integer number specifying by percentage how much the font-size must be adjusted. For instance, this PER-FONT: ((devanagari-cdac) 150) instructs the font handler of the m17n library to open a font of 1.5 times bigger than a requested size on opening a font whose registry is 'devanagari-cdac'. COPYRIGHT
Copyright (C) 2001 Information-technology Promotion Agency (IPA) Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>. Version 1.6.2 12 Jan 2011 mdbFontSize(5)
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy