f



Midpoint of a line, Thirdpoint of line, Quarterpoint of line

Dear Matlab community,

For some reason I am having difficulty formulating the points that divide a line segment into thirds and fourths.  The midpoint is easy, just the (mean([x1,x2]),mean([y1,y2])), but for some reason my mind is blanking on the others. Please help point me in the right direction.  I will do the rest.

Thanks in advance.
Eric
0
eric.diaz (70)
2/20/2012 5:03:11 AM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1135 Views

Similar Articles

[PageSpeed] 52

Nevermind...figured it out.  sorry to bother, I was just having a lapse in my thinking.
0
eric.diaz (70)
2/20/2012 5:19:13 AM
Reply:

Similar Artilces:

reading a file line by line and using the line in another script
Hi I am reading the file line by line and assgning it to the variable this variable used in another script called deploy_3.ksh. I am able do that just for the first line. My file consists of three lines for the other to lines an error occurs Found line: amireddy@baja.iso.ksu.edu:/home/baja/amireddy I00020133: 'test.txt' copied into the directory:'/home/baja/amireddy' on the machine 'baja.iso.ksu.edu' E03020134: Warning: No xauth data; using fake authentication data for X11 forwarding. E03020134: Warning: No xauth data; using fake authentication data for X11 forwarding. I00020133: ===================================================================== while read line do echo "Found line: $line" dest_dir=&line ## We call deploy3 to copy the file to the ## destination directory found in the file .. ${HARVEST_SCRIPTS}/deploy_3.ksh "${environment}" "${state}" "$ {viewpath}" "${item}" done< $dest_dir1 nitesh.reddy@gmail.com wrote: > Hi I am reading the file line by line and assgning it to the variable > this variable used in another script called deploy_3.ksh. > I am able do that just for the first line. My file consists of three > lines > for the other to lines an error occurs > > Found line: amireddy@baja.iso.ksu.edu:/home/baja/amireddy > I00020133: 'test.txt' copied into the directory:'/home/baja/amireddy' > on the machine 'baja.iso.ksu.edu' &g...

Make single line from parallel lines w/o deleting lines
Have a script that makes a single line from parallel lines and then deletes the parallel lines. I have tried to modify it to where the parallel lines do not delete but I'm getting nowhere. Any suggestions as to modify the script to not delete the lines? Please show what the code is when explaining the solution. (defun avg2 (a b) (/ (+ a b) 2.0)) ;;singln - Replaces parallel lines with a single line. (defun c:singln ( / ss e1 e2 ei ei2 p1 p2 p3 p4) (and (princ "\nSelect 2 parallel lines: ") (setq ss (ssget (list (cons 0 "line")))) (setq e1 (ssname ss 0)) (setq e2 (ssname ss 1)) (setq ei (entget e1)) (setq ei2 (entget e2)) (setq p1 (cdr(assoc 10 ei))) (setq p2 (cdr(assoc 11 ei))) (setq p3 (cdr(assoc 10 ei2))) (setq p4 (cdr(assoc 11 ei2))) (or (< (distance p1 p3)(distance p1 p4)) (setq pt p3 p3 p4 p4 pt)) (entmod (list (cons -1 e1) (cons 10 (mapcar 'avg2 p1 p3)) (cons 11 (mapcar 'avg2 p2 p4)))) (entdel e2)) (princ)) Change (entmod to (entmake then delete (entdel e2) ....but leave the last ")" in that line. ___ <jwbike@gmail.com> wrote in message news:1170690791.899347.184120@h3g2000cwc.googlegroups.com... > Have a script that makes a single line from parallel lines and then > deletes the parallel lines. > I have tried to modify it to where the parallel lines do not ...

line by line compiling in c
hello every body i am new to programming in c fed up of getting compiling errors can u tell me how to do line by line compiling......... vaavi <vavasgroups@gmail.com> wrote: > i am new to programming in c > fed up of getting compiling errors > can u tell me how to do line by line compiling......... You can't. Most lines don't make sense out of context. And even if you could why would that make compiling errors go away? If you feel overwhelmed by the number of error messages (of which many might be follow-up errors) just look only for the first one, correct the problem and recompile and continue in that way until the compiler is satisfied. If you're done with that raise the warning level of your compiler and repeat - many compilers are per default only telling you about your worst mistakes but can find a lot more of problematic code if asked to. And that often helps a lot in getting a working program, it's often much quicker than trying to find bugs with a debugger. Regards, Jens -- \ Jens Thoms Toerring ___ jt@toerring.de \__________________________ http://toerring.de On 30 May, 18:16, vaavi <vavasgro...@gmail.com> wrote: > hello every body > > i am new to programming in c > =A0fed up of getting compiling errors > =A0can u tell me how to do line by line compiling......... Dude, if you're getting that many errors, you need to do-line-by-line coding. On Fri, 30 May 2008 ...

Read from *.txt inside SimEvetns Embedded Matlab line by line
Hi all, I have a text file named WF.txt and it has the following data: Job Task Cores ET Depend 1 1 5 10 1 2 15 25 1 1 3 10 15 2 1 4 20 10 2,3 These are specifications for workflow jobs stored in WF.txt, I have simulated a queueing model in SimEvents. I have an entity generator with the attributes matching the text file's headers i.e. Job, Task, etc.. I've designed my model to have the entitiy generator placed before a matlab embedded function, and what I want to be able to do is extracting one row from the text file for each generated entity at a time and then assign the right value for the right attribute. For instance I want my first entity to be like this: Job = 1; Task = 1; Cores = 5; ET = 10; Depend = '', and for the second entity to have it as follows: Job = 1; Task = 2; Cores = 15; ET = 25; Depend =1. I'm not sure whether it's best to use Embedded Matlab Editor or Function, as for the latter it requires me to do something with eml.extrinsic. The other minor issue here is for 'Depend' as it can have multiple values like in the last row, how can I then assign those to an entity attribute inside SimEvents, adn what format do you suggest for it? Many thanks you guys and looking forward your comments :-). ________________ Tiger ...

Dumbest Question of the Day - 120 Lines of Code - 110 Lines of .rc
Hi Folks: Developing on XP Home, VS 2008 Pro, C++, WIN32, no MFC. This is embarrassing. I seem to have lost the ability to write a simple app with a pop up child. When the child dialog is terminated, the parent has no focus, and is disabled. Isn't Windows supposed to return focus to the parent and enable it after a modal child terminates? I have added code to test for the parent being disabled when returning from the child and enabling the parent if needed. If uncommented this seems to work, but I've never needed to do this before, and it seems to fail when children spin off children of their own. So, what incredibly stupid thing am I doing, and not seeing? Thanks to anyone who takes the time to look at this code. Warning, the parent is inactivated, and doesn't respond to a click on the big red X in the upper right frame. So run this from a debugger. If run without debugging you will need to terminate this with the task manager <Ctl-Alt-Del>. Go to the "Application" tab and end "Test". To pop up the child, select "Edit" from the "Operation" menu. To end the child, and elicit the problem, hit "Cancel" in the edit window. Sorry about the amount of stuff that follows. I have tried to pair the C++ to the smallest amount that will cause the problem, but I've chosen to copy the .rc file and the resource.h unaltered. Source: ...

Line by line file processing in bash
I've two text files of the same length which contain in each line a string (specifier of given application) followed by an (unsigned) integer. This looks like this: File 1: A; 100 B; 200 File 2: A; 400 B; 10 I would like a bash script to go simultaneously through both files line by line and accumulate the results of the division, i.e. result = 400/100 + 10/200 How can this be done? Regards, Tim Tim Frink <plfriko@yahoo.de> writes: > I've two text files of the same length which contain in each line a string > (specifier of given application) followed by an (unsigned) integer. This > looks like this: > > File 1: > A; 100 > B; 200 > > File 2: > A; 400 > B; 10 > > I would like a bash script to go simultaneously through both files line > by line and accumulate the results of the division, i.e. > > result = 400/100 + 10/200 > > How can this be done? It's not very robust but if you are sure of your format this might be what you want: echo scale=3\; $(pr -tms/ <(cut -d\ -f2 file2) \ <(cut -d\ -f2 file1) \ | sed 's/$/+/') 0 | bc (Be careful: there is a quoted space after -d in the cut commands. maybe '-d ' is a better syntax.) The cut commands give you the two columns of numbers and the pr command merges the lines with a / between the new columns. We add a + after each line with sed and the echo add a scale setti...

showing grid lines as dashed lines
Dear All, i am using a waveform chart to plot my data .. i want to insert grid inside my chart .There are 3 different options for inserting grids in d chart .&nbsp;is dere any way i can change the style of lines of grids ?? i want to see them as dashed lines rather than a continous line ...&nbsp;&nbsp;&nbsp;ThanksRitesh Right click on the plot and choose line styles but am not sure whether u r looking for this. That will only change the line style of the data, and not the grids .&nbsp;I want to chage the grid lines to dashed.. Do u want a graph that looks like this?&nbsp;<img src="http://forums.ni.com/ni/attachments/ni/170/349281/1/gridd.PNG" border="0">&nbsp; Message Edited by muks on 08-14-2008 08:40 AM gridd.PNG: http://forums.ni.com/ni/attachments/ni/170/349281/1/gridd.PNG ritesh024 wrote: i want to see them as dashed lines rather than a continous line ...&nbsp; I don't think there is a direct way, but you could make your own custom grid using the &quot;plot images&quot;. Check the example finder. I want something like this. Grid with Dashed Lines.JPG: http://forums.ni.com/ni/attachments/ni/170/349343/1/Grid with Dashed Lines.JPG Have you tried the &quot;plot images&quot; property node as I mentioned? You should be able to easy do whatever you want. ...

line coordinate data and line width
Hi, The goal of my code is to generate a grid of channels with defined thickness. It will later be used to plot the motion of a particle moving through this grid, by bounding the particle to move only within the line, which has a thickness and a color. So far, I'm plotting my lines using the function " line([x1, x2], [y1,y2], 'Color','r','LineWidth',2) " where x1, x2, y1, and y2 are generated by a for loop. So I was wondering if there is a way to return all coordinates of pixels used to draw that line. I have tried using " h = get(gca,'Children'); h2 = get(h,'XData') " But it returns a list of "[1x2 double]" Also, is there a way to set the Unit of linewidth to pixels, or perhaps a better way to accomplish this? Thanks in advance. SHark wrote: > line([x1, x2], [y1,y2], 'Color','r','LineWidth',2) > So I was wondering if there is a way to return all coordinates of pixels > used to draw that line. No, not without doing a screen capture and analyzing the matrix of pixels that gets returned by that. There are different algorithms in use (by different programs) to decide which pixels should be lit or not, especially for lines at an angle. To make sense of it, you have to start thinking of drawn lines as reflecting something to do with positions that are within LineWidth/2 along the normal to the slope of the zero-width i...

reading text file line by line
Hello, I have a big text file called data.txt. Would like to read this to Matlab. I am trying to do this with the following code==> KK=fopen('F:\commands\data.txt'); A=fscanf(KK,'%s'); This reads the whole content of data.txt to A without any line breaks or spaces. How to make it read line by line and keeping the spaces as in data.txt? Thanks Leyo On 8/3/2012 2:03 PM, Leyo Joseph wrote: .... .... > A=fscanf(KK,'%s'); > > This reads the whole content of data.txt to A without any line breaks or > spaces. How to make it read line by line and keeping the spaces as in > data.txt? .... data = textread('data.txt','%s','delimiter','\n','whitespace',''); In recent releases, use textscan() instead of textread() -- dpb <none@non.net> wrote in message <jvh7tp$2hl$2@speranza.aioe.org>... > On 8/3/2012 2:03 PM, Leyo Joseph wrote: > ... > > ... > > > A=fscanf(KK,'%s'); > > > > This reads the whole content of data.txt to A without any line breaks or > > spaces. How to make it read line by line and keeping the spaces as in > > data.txt? > ... > > data = textread('data.txt','%s','delimiter','\n','whitespace',''); > No...This didn't work... It is just giving a column matrix with ' ' >> > -- On 8/3/...

Read specific lines or line from file.
I am working on a system that is reading a large amount of data from text files that are basically sensor recordings at about 25Hz. The way I have been doing this is to read the entire text file with fscanf (or the first N~20000 lines) and just work access them though a cell array at each time step. However this produces an enormousness amount of over head becasue there are about 8 files each with about 50000 lines and 10 columns. What I was looking to do was to read the files lines by line as I need them. The files will always be accessed in order but the start frame may not always be one (i.e. I might want to start analysis at the 10000th time index). There is also a number of secondary calculations i need to do with each frame from all the files, so i don't want to read directly from the main function. I would like to either open the file whenever I need to read, and then jump to the line or lines that I would like to read in, and begin there. I haven't found an easy way to do this in matlab yet without reading in the first N lines and just throwing them out... Any help or suggestions would be greatly appreciated... -Jameson On 5/25/2012 3:17 PM, Jameson wrote: .... > I would like to either open the file whenever I need to read, and then > jump to the line or lines that I would like to read in, and begin there. > I haven't found an easy way to do this in matlab yet without reading in > the first N lines and just throwing th...

replacing lines in a file with lines from another file
This should be an easy one for you smart UNIX people. I have two files. I need to replace every 4th line in File A with the corresponding line in File B. So when I vi my output file I want to see: 1 [Line 1 from File A] 2 [Line 2 from File A] 3 [Line 3 from File A] 4 [Line 4 from File B] 5 [Line 5 from File A] 6 [Line 6 from File A] 7 [Line 7 from File A] 8 [Line 8 from File B] .....etc.... I'm not that smart so I can't figure out how to do it. A script would be fine, as would a single command line. �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� �.�� �.�*���*�. THANK YOU!!.�*���*�.� ��.� �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� �.�� �.�*���*�.� ��.��.�� �.�*���*�.� ��.� Elliot wrote: > This should be an easy one for you smart UNIX people. > > I have two files. I need to replace every 4th line in File A with the > corresponding line in File B. So when I vi my output file I want to see: > > 1 [Line 1 from File A] > 2 [Line 2 from File A] > 3 [Line 3 from File A] > 4 [Line 4 from File B] > 5 [Line 5 from File A] > 6 [Line 6 from File A] > 7 [Line 7 from File A] > 8 [Line 8 from File B] > ....etc.... One possibility... paste -d $'\n' FileA FileB | awk 'NR%8==1||NR%8==3||NR%8==5||NR%8==0' Janis > > I'm not that smart so I can't figure out how to do it. A scri...

max line lenght of a line in the aliases file
i want to use a whole heap of external email addresses in a single alias file to make a small distribution list. whats the max length of a single line, and could i use \ to represent a line continuation for unlimited email addresses? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Tim Warnock" <timoid@nospam.getonit.net.au> writes: >i want to use a whole heap of external email addresses in a single alias >file to make a small distribution list. >whats the max length of a single line, and could i use \ to represent a line >continuation for unlimited email addresses? You can just continue on several lines, indenting each continuation line with a tab or space. If you are using dbm, I think that sets a 1024 limit. Otherwise it is limited by buffer space in the sendmail code (might also be 1024, but you can check the code). But do yourself a favor. Use aliasname: :include:/path/to/include-file and list all of the address, one per line, in the include file. That's far easier to maintain, and is limited only by the memory available for recording the complete recipient list. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (SunOS) iD8DBQFBaHVrvmGe70vHPUMRAk3lAJwKicvZnvi6sNZyoxdlJrEWH+2TpgCeItSC JDfeoYUG2mXgyeq7sPMVbSM= =x6Ib -----END PGP SIGNATURE----- -- vote for regime change in Washington, Nov 02. "Neil W Rickert" <rickert+nn@cs.niu.edu> wrote in message news:ck9shi$1bk$1@usenet.cso.niu.edu... > But ...

read text file line by line until eof
Hi there, I would like to read single lines from a file and compare them to some kind of input string. I have come up with this code: [code] if [catch {open $barcode::OP_file r} fp] { set barcode::status "can't open operator file:\n $barcode::OP_file" return } else { while {[eof $fp]!=1} { gets $fp newline delay 500 set barcode::status $newline set barcode::scancode "Ron Eggler" #compare currently read line from file with bar code if {[string compare -nocase $barcode::scancode $newline]==0} { set barcode::status "tech validated!\nstart testing now..." } else { set barcode::status "ACCESS DENIED!\nnot able to validate $barcode::scancode!" return } close $fp lappend finaltest::operatorList $newline } } [/code] But what's happening is, that thw while {[eof $fp]!=1} doesn't seem to be working as it's not looping at all... why cdould this be? Shouldn't this stay in the while loop until the gets command gets an eof? It's kinda weird...no? Thanks for help and hints! Ron On Wed, 21 Jan 2009 07:07:55 -0800 (PST), cerr wrote: >But what's happening is, that thw while {[eof $fp]!=1} doesn't seem to >be working as it's no...

On-Line
On-Line http://anaconda-manifesto.blogspot.com/ ...

Prepend lines with obtained data from previous line
Hi, How can I prepend each line found with the data/time that's given for each iteration??? Example: Convert: Date/Time: 4/27/09 12:05:07 AM Proin mattis nisl nec vitae tellus ac mi hendrerit adipiscing lorem nec sapien ultrices aliquam Date/Time: 4/27/09 12:10:07 AM mattis nisl nec sapien unc lobortis tempor q consectetur adipiscing elit To: 4/27/09 12:05:07 AM Proin mattis nisl nec 4/27/09 12:05:07 AM vitae tellus ac mi hendrerit adipiscing 4/27/09 12:05:07 AM lorem nec sapien ultrices aliquam 4/27/09 12:10:07 AM mattis nisl nec sapien 4/27/09 12:10:07 AM unc lobortis tempor q 4/27/09 12:10:07 AM consectetur adipiscing elit Can awk even do this?? Thanks, PointyWombat pete.hackett@gmail.com wrote: > Hi, > > How can I prepend each line found with the data/time that's given for > each iteration??? > > Example: > > Convert: > Date/Time: 4/27/09 12:05:07 AM > Proin mattis nisl nec > vitae tellus ac mi hendrerit adipiscing > lorem nec sapien ultrices aliquam > > Date/Time: 4/27/09 12:10:07 AM > mattis nisl nec sapien > unc lobortis tempor q > consectetur adipiscing elit > > To: > 4/27/09 12:05:07 AM Proin mattis nisl nec > 4/27/09 12:05:07 AM vitae tellus ac mi hendrerit adipiscing > 4/27/09 12:05:07 AM lorem nec sapien ultrices aliquam > > 4/27/09 12:10:07 AM mattis nisl nec sapien > 4/27/09 12:10:07 AM unc lobortis tempor q > 4/27/09 12:10:07 AM consectetur adipiscing elit >...

PHP read large file line by line?
hi, how to read a large php file line by line? fread can't? thanks. Hmm howa <howachen@gmail.com> wrote: > hi, > > how to read a large php file line by line? fgets -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl 2be || !2be $this => mysql_query(); $file_array = file($file_name); foreach ($file_array as $line_number => $line) { // Handle the line } See: http://us3.php.net/manual/en/function.file.php howa wrote: > hi, > > how to read a large php file line by line? > > fread can't? > > thanks. > ZabMilenko wrote: > > $file_array = file($file_name); > > foreach ($file_array as $line_number => $line) > { > // Handle the line > } > > > > See: http://us3.php.net/manual/en/function.file.php > > > howa wrote: > >> hi, >> >> how to read a large php file line by line? >> >> fread can't? >> >> thanks. >> The problem with your solution is it reads the entire file into the array. Note he said LARGE FILE. This could very quickly run him out of memory. Ikciu has the correct answer. fgets() is the way to go. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== [ Please don't top-post. Read http://www.caliburn.nl/topposting.html ] ...

Howto read file line-by-line in bash
The content of test.data is -bash-3.2# cat test.data line1 line2 line3 It is important that there is no trailing EOL at the end of file. I read test.data with the following script: -bash-3.2# cat test.sh #!/bin/bash while read line do echo "$line" done < "test.data" -bash-3.2# ./test.sh line1 line2 That is, "line3" is lost. Questions: 1. What is a nice way to fix this code? 2. The code of the script pretends to be a stdandard way if reading text file line-by-line because it is recommended by respected resources (e.g. http://bash-hackers.org/wiki/doku.php/tests/bashfaq). Provided the code is ok, does it mean that a typical text file in Unix/ Linux should have EOL at the end? 2008-03-20, 02:38(-07), Viatly: > The content of test.data is > > -bash-3.2# cat test.data > line1 > line2 > line3 > It is important that there is no trailing EOL at the end of file. > I read test.data with the following script: > > -bash-3.2# cat test.sh > #!/bin/bash > while read line > do > echo "$line" > done < "test.data" > > -bash-3.2# ./test.sh > line1 > line2 > > That is, "line3" is lost. > Questions: > 1. What is a nice way to fix this code? The nicest way is to avoid while read loops in shells. > 2. The code of the script pretends to be a stdandard...

join lines but leave blank lines alone
source file: Wed Jun 29 12:34:51 2005 User-Name = "username" Calling-Station-Id = "00:20:EE:1E:86:CD" Called-Station-Id = "00:00:00:55:A6:9A" Wed Jun 29 12:34:51 2005 User-Name = "username2" Calling-Station-Id = "00:20:EE:1E:86:CD" Called-Station-Id = "00:00:00:55:A6:9A" desired destination file: Wed Jun 29 12:34:51 2005|Wed Jun 29 12:34:51 2005|Wed Jun 29 12:34:51 2005|Wed Jun 29 12:34:51 2005 Wed Jun 29 12:34:51 2005|User-Name = "username2"|Calling-Station-Id = "00:20:EE:1E:86:CD"|Called-Station-Id = "00:00:00:55:A6:9A anyone? I am generally good with scripting but can't seem to fig. this out. I know you use the !J thing to join two lines but how do you seperate them with a pipe char and leve the blank lines alone?? On 2005-06-30, news8080@yahoo.com wrote: > source file: > > Wed Jun 29 12:34:51 2005 > User-Name = "username" > Calling-Station-Id = "00:20:EE:1E:86:CD" > Called-Station-Id = "00:00:00:55:A6:9A" > > Wed Jun 29 12:34:51 2005 > User-Name = "username2" > Calling-Station-Id = "00:20:EE:1E:86:CD" > Called-Station-Id = "00:00:00:55:A6:9A" > > desired destination file: > > Wed Jun 29 12:34:51 2005|Wed Jun 29 12:34:51 2005|Wed Jun 29 12:34:51 > 2005|Wed Jun 29 12:34:51 2005 ...

get title line on a multi-line graph
hello, my problem look like that: I have some file which I called 01.dat,02.dat,03.dat,04.dat...... in each file I have two column of data (temperature and deep) which I'd like to plot... For plotting it I've no problem, I get all the curve on one graph but the thing is, that, now I would like that when I click with the mouse on one curve it tells me what is the title of my curve.... I've try to put a tag on my curve but it doesn't work... and the function clabel can not work either for this kind of graph how can I do which function can I use thank you very much remy remy wrote: > when I click with the mouse on one curve it tells me what > is the title of my curve.... Salut, the easiest way is to use the "uicontextmenu" property : (right click on curves) : figure th=0:0.05:2*pi; hold on p1=plot(th,cos(th),'r-') p2=plot(th,sin(th),'b-.') cmenu=uicontextmenu; uimenu(cmenu,'label','cosinus') set(p1,'uicontextmenu',cmenu) cmenu=uicontextmenu; uimenu(cmenu,'label','sinus') set(p2,'uicontextmenu',cmenu) You can also use "buttondownfcn" property and "text" function. J�r�me thank you very much jerome you save my life one again...... ...

modify a line in a line graph using code
i need to modify a specific series, line weight and color. however, i need to specify the series number, which can change. how can i translate or set the series name (object) to the number? ...

Re: loop through file to compare line above and line below?
Hmmm been a while since I work cattle but I dont think that will be much of a problem here. Still miss the good ol days. This should get you started: Data CatList ; Format DateTime DateTime20. ; Input ID DateTime DateTime18. CowWeight CalfWeight ; Cards ; 121212 01Jun2007:07:52:00 470 100 121212 01Jul2007:11:53:00 470 100 121212 01Jul2007:11:54:00 465 90 199999 05Jul2007:10:22:00 448 90 199999 05Jul2007:10:24:00 454 80 199999 08Jul2007:02:21:00 454 90 Run ; Data Need ( Drop = LastCow LastCalf LastDateTime ) ; Set CatList ; By ID DateTime ; Retain LastCow LastCalf LastDateTime ; If ( Not First.Id ) Then Do ; If ( ( DateTime - LastDateTime ) Le 120 ) And ( ( CowWeight Ne LastCow ) Or ( CalfWeight Ne LastCalf ) ) Then Output ; End ; LastCow = CowWeight ; LastCalf = CalfWeight ; LastDateTime = DateTime ; Run ; Notice I reworked your original data. Basically I modified it to to a form more suitable to a SAS solution. Toby Dunn "Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch "Be prepared. Luck is where preparation meets opportunity." Randy Pausch > Date: Mon, 19 May 2008 21:38:19 -0700 > From: haleyjo@GMAIL.COM > Subject: loop through file to compare line above and line below? > To: SAS-L@LISTSERV.UGA.EDU > > We mark our cattle with tag ids for various reasons - here it is when > they have a baby, and we weigh both mom and baby. The file looks like > this: >...

Read text file line by line and write to matrix
Hi there, I have a dataset in an ASCII file with no constant delimiter between the data values, therefore all the ways that I know to import the data to Matlab do not work... The dataset is composed of strings and numbers, (I'm only interested in the number) and I would like to verify the file line by line and if the character "#" appears I want to save from column 13-16 in the first line and column. Otherwise I would like to save from column 16-20 in the following lines.... When the character "#" appears again I would like to change column save the values in the first line and continue to save the data in the following lines... and to keep doing it until the end of the ASCII file..... Is there any way of doing this in Matlab? On 3/28/2012 10:57 AM, João Carlos wrote: > Hi there, > > I have a dataset in an ASCII file with no constant delimiter between the > data values, therefore all the ways that I know to import the data to > Matlab do not work... > The dataset is composed of strings and numbers, (I'm only interested in > the number) and I would like to verify the file line by line and if the > character "#" appears I want to save from column 13-16 in the first line > and column. Otherwise I would like to save from column 16-20 in the > following lines.... When the character "#" appears again I would like to > change column save the values in the first line and continue to save th...

Insert Multiple Lines after a Specified Line -- Please Help!
I am new to PERL (mostly use UNIX Krn Shell) I am trying to automate some file manipulation techniques. I have figured out how to Delete and Append Lines in a file, but I can't figure out how to insert in this partcular way. I want to insert a few lines after a line that I specify. For Example: The file contains the following contents: ABCDEFG HIJKLMNO PQRSTUV WXYZ As a driver file, I have created updates I want to make to my existing file, where "IA" is the line I want to insert after, and "IL" are the lines that need to be inserted. The two digit number just helps in defining the group they belong to. (Maybe to help for looping?) IA00:HIJKLMNO IL00:12345 IL00:67890 IA01:PQRSTUV IL01:24680 IL01:13579 The new file should result as: ABCDEFG HIJKLMNO 12345 67890 PQRSTUV 24680 13579 WXYZ I am sure I am making the script more complicated as it is. For some reason, I am confused with the variables and generating dynamic ones to name the arrays. (That is if I split the file into parts). # IF THE INSTRUCTIONS ARE TO INSERT A LINE if ($update_line =~ /^I\w\d\d:/) { open (my $INPUT, "<$origfile") or die "$! error."; my $group; my $afterline; if ($line[0] =~ /^IA/) # if matched the first line to be changed { $group=substr($line[0], 2); $afterline=$line[1]; open (my $update, "<$update_file") or die "$! error."; while ( <$update> ) { my @insert_lines =( grep ("IL$gro...

Re: constructing string within a line to different lines
Sohail, It sounds like you want to build an include file. If that is the case, and the following does what you want, you could simplify it by loading the variables in one array, the variable names in another, and then build the lines within a simple loop. Art data have; input var_name $4. (max min std ltd ltr msn msd) ($2.) in_table $8. months 3.; cards; var1 x x x x x x x table1 6 var2 x x x x x x table2 12 ; filename create "k:\want.sas"; data _null_; file create; set have; if not(missing(max)) then do; put '%max(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(min)) then do; put '%min(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(std)) then do; put '%std(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(ltd)) then do; put '%ltd(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(ltr)) then do; put '%ltr(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(msn)) then do; put '%msn(v=' var_name ',month=' months ',table=' in_table ');'; end; if not(missing(msd)) then do; put '%msd(v=' var_name ',month=' months ',table=' in_table ');'; end; run; --------- ...

Web resources about - Midpoint of a line, Thirdpoint of line, Quarterpoint of line - comp.soft-sys.matlab

The 13 reasons Alabama lost the Iron Bowl, some obvious, others more subtle - AL.com
A detailed look at what went wrong Saturday night in Jordan-Hare Stadium.

BRIC faces elevated risk of credit-bubbles and rising defaults
LONDON: Brazil, Russia, India and China face an "elevated" risk of credit bubbles and rising defaults if inflation accelerates and economic growth ...

Resources last updated: 3/30/2016 2:11:45 PM