lines

Program skips everyother line, but not sure why [duplicate]

不打扰是莪最后的温柔 提交于 2019-12-11 06:46:46
问题 This question already has answers here : Scanner skipping every second line from file [duplicate] (5 answers) Closed last year . My program prints all the data on the line, but only prints every other line. I know that it has something to do with the "nextLine", but I cannot find whats causing the problem. import java.io.*; import java.util.*; public class hw2 { public static void main (String[] args) throws Exception { String carrier; int flights; int lateflights; int ratio; String[][]

Scatter plot with coloured groups and different markers within a group

本秂侑毒 提交于 2019-12-11 03:45:58
问题 I am trying to make kind of a scatter plot with different groups. In addition to this I would like to have 2 different markers and one color for each set of 2 points, which are also connected with a line. But see below for details I have 4 matrices Db = [0.4745 0.3886 0.3316 0.2742; 0.5195 0.3825 0.3341 0.2846; 0.4929 0.3951 0.3161 0.2918; 0.4905 0.4052 0.3240 0.2882]; Dw = [0.4814 0.3905 0.3418 0.2922; 0.5258 0.3952 0.3420 0.2974; 0.4945 0.4012 0.3386 0.3001; 0.4885 0.4076 0.3382 0.3056]; Sb

How to configure the scale label position in ILNumerics?

若如初见. 提交于 2019-12-11 03:38:41
问题 I draw some lines with ILLinePlot. Then I rotate the cube (with the intention to change the position of the Y scale label that starts from the top): Rotation = Matrix4.Rotation(new Vector3(1, 0, 0), ILMath.pif), It produces results like this. In this graph, I am losing the scale label in Y axis. How to configure it? So the label can be shown? Update: This question is related to : How to reverse the axis in ILNumerics At first, I have make a graph that consists some lines like this figure:

Matplotlib Plot Lines Above Each Bar

对着背影说爱祢 提交于 2019-12-10 17:49:07
问题 I would like to plot a horizontal line above each bar in this chart. The y-axis location of each bar depends on the variable 'target.' I want to use axhline, if possible, or Line2D because I need to be able to modify the line style, color, length, and width. import matplotlib.pyplot as plt plt.rcdefaults() import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Example data people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') #Here are the targets that I want to use #to plot

Parsing a text file into a list in python

回眸只為那壹抹淺笑 提交于 2019-12-10 17:33:14
问题 I'm completely new to Python, and I'm trying to read in a txt file that contains a combination of words and numbers. I can read in the txt file just fine, but I'm struggling to get the string into a format I can work with. import matplotlib.pyplot as plt import numpy as np from numpy import loadtxt f= open("/Users/Jennifer/Desktop/test.txt", "r") lines=f.readlines() Data = [] list=lines[3] i=4 while i<12: list=list.append(line[i]) i=i+1 print list f.close() I want a list that contains all the

C# Regex Match any text between tags including new lines

不羁的心 提交于 2019-12-10 16:37:54
问题 Here is my regex: \[\[START\]\]\[\[OK\]\](.*?)\[\[END\]\] I want to get any text contained in [[START]][[OK]] and [[END]] . However when my text contains some \r\n characters, my regex doesn't match it. How can it make it work? 回答1: Use single-line mode http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx#Singleline 回答2: I don't know for sure if this works for RegEx'es as well,but you could try using Environment.NewLine in stead of \r\n. 来源: https://stackoverflow.com/questions/6179116/c

Write Text In A Already Existing Text File VB.NET

*爱你&永不变心* 提交于 2019-12-10 16:04:54
问题 I've been developing a arcade game, and as every good arcade game, it has an incorporated scoreboard so that players can see who scored better. My problem is that everytime it enters a new scoreline, it deletes all the previous lines in the text file. The code I've been using is the following: If player1 > 25 Then objReader.Close() MsgBox("O " + jogador1 + " ganhou.") tab1.Enabled = False Dim wrtScore As String = "C:\Documents and Settings\Joao\My Documents\Visual Studio 2010\Projects

Select random 3000 lines from a file with awk codes

北战南征 提交于 2019-12-10 14:49:20
问题 I want to select randomly 3000 lines from a sample.file which contains 8000 lines. I will do that with awk codes or do from command line. How can I do that? 回答1: If you have gnu sort, it's easy: sort -R FILE | head -n3000 If you have gnu shuf, it's even easier: shuf -n3000 FILE 回答2: awk 'BEGIN{srand();} {a[NR]=$0} END{for(i=1; i<=3000; i++){x=int(rand()*NR) + 1; print a[x];}}' yourFile 回答3: Fixed as per Glenn's comment: awk 'BEGIN { a=8000; l=3000 srand(); nr[x] while (length(nr) <= l) nr[int

Lines between certain points in a plot, based on the data? (with R)

感情迁移 提交于 2019-12-10 12:05:55
问题 I have done my research and googling but have yet to find a solution to the following problem. I have quite often found solutions to R-related issues from this forum, so I thought I'd give it a try and hope that somebody can suggest something. I would need it for my PhD thesis; anybody who's code or suggestions I will use will naturally be acknowledged and credited. So: I need to draw lines/segments to connect points in a plot (of multidimensional scaling, specifically) in R (SPSS-based

How to delete partial duplicate lines with AWK?

此生再无相见时 提交于 2019-12-10 11:07:52
问题 I have files with these kind of duplicate lines, where only the last field is different: OST,0202000070,01-AUG-09,002735,6,0,0202000068,4520688,-1,0,0,0,0,0,55 ONE,0208076826,01-AUG-09,002332,316,3481.055935,0204330827,29150,200,0,0,0,0,0,5 ONE,0208076826,01-AUG-09,002332,316,3481.055935,0204330827,29150,200,0,0,0,0,0,55 OST,0202000068,01-AUG-09,003019,6,0,0202000071,4520690,-1,0,0,0,0,0,55 I need to remove the first occurrence of the line and leave the second one. I've tried: awk '!x[$0]++