text-files

Reading a known number of variable from a file when one of the variables are missing in input file

↘锁芯ラ 提交于 2019-12-24 09:49:03
问题 I already checked similar posting. The solution is given by M. S. B. here Reading data file in Fortran with known number of lines but unknown number of entries in each line So, the problem I am having is that from text file I am trying to read inputs. In one line there is supposed to be 3 variables. But sometimes the input file may have 2 variables. In that case I need to make the last variable zero. I tried using READ statement with IOSTAT but if there is only two values it goes to the next

Pickle module in Python and text files

廉价感情. 提交于 2019-12-24 09:27:09
问题 I have recently asked a question and received an answer that I must 'pickle' my code. As a beginner, I have no idea how to do that. 回答1: So, if I understood correctly by looking at the other two questions (1 and 2) you made related to this, your problem has two parts: One is generating a file with a list of user/passwords and the second is using that file to do a "login" system. The problem with writing to files is that you can regard a file as just text... It doesn't really retain the

Scroll multiple TextViews simultaneously

我的未来我决定 提交于 2019-12-24 09:00:04
问题 I have a string from a file that am storing into 3 separate TextViews because I was having alignments issues with a single TextView. How can I scroll only this section of my screen to see all of the contents of the file? BufferedReader buf = new BufferedReader(new FileReader(file)); while((line = buf.readLine())!= null) { StringTokenizer st = new StringTokenizer(line); a = st.nextToken(); b = st.nextToken(); c = st.nextToken(); text1.append(a + '\n'); text2.append(b + '\n'); text3.append(c +

Read data files with specific format in matlab and convert date to matal serial time

ⅰ亾dé卋堺 提交于 2019-12-24 08:59:42
问题 I have a file with the following structure: 29-JUN-1995 09:29:15 21.43 41.03 22.76 8.61 1 307.98 0.85 -9.99000e+002 -999.000000 2.050651 2.323905 4.86704e+015 6.869425 2.099744 2.135507 0.66 849.584 907.607 992 29-JUN-1995 09:29:19 24.62 40.12 20.67 -14.24 0 325.23 0.79 -9.99000e+002 -999.000000 2.095562 2.095562 3.95402e+015 10.898932 2.113338 2.113338 0.00 -1.000 1010.324 992 29-JUN-1995 09:29:21 21.32 40.68 22.56 8.61 1 309.55 0.86 -9.99000e+002 -999.000000 2.047019 2.399543 5.12189e+015 7

Powershell Script to convert txt to xlsx

主宰稳场 提交于 2019-12-24 08:56:20
问题 I want to convert a textfile to Excel Format. I use the following script from Technet: # Script name: ConvertTilde.ps1 # Created on: 2007-01-06 # Author: Kent Finkle # Purpose: How Can I Convert a Tilde-Delimited File to Microsoft Excel Format? $s = gc C:\Scripts\Test.txt $s = $s -replace("~","`t") $s | sc C:\Scripts\Test.txt $xl = new-object -comobject excel.application $xl.Visible = $true $wb = $xl.Workbooks.Open("C:\Scripts\Test.txt") $wb.SaveAs(“D:\Excel\Test.xlsx”) The Script works,

vba converting multiple pdf in folder to text file

随声附和 提交于 2019-12-24 06:25:52
问题 I was trying to run a vba to convert multiple pdf file in a folder into txt file in another folder. however, I encountered the following error which I was not able to resolve. The error is at Set jsObj = AcroXPDDoc.GetJSObject which gave me a runtime error 91: "Object variable or With block variable not set" Can anyone help? Thanks. :Updated with new code Option Explicit Sub convertpdf5() Dim AcroXApp As Acrobat.acroApp Dim AcroXAVDoc As Acrobat.AcroAVDoc Dim AcroXPDDoc As Acrobat.AcroPDDoc

fopen not work with XCode

萝らか妹 提交于 2019-12-24 05:59:28
问题 The function fopen(FILE *fp) in XCode it's not working, I put the text file in the root directory, but not work, it's weird because, executing from terminal works fine, but executing from IDE not. The sintax that I use it's this: FILE *fp=fopen("name.txt", "r"); if(fp==NULL) { printf("the text file can't be opened"); exit(0); } else return fp; And always return NULL . 回答1: well what's the working directory when run via xcode? by default IIRC it isnt set and that might be the difference

Creating a dictionary from text file Python Numpy

谁说我不能喝 提交于 2019-12-24 05:46:04
问题 I have a text file that looks like this: # Comments PARAMETER 0 0 1045 54 1705 0 time 1 1 10 100 0.000e+00 9999 A 2 20 200 0.2717072 9999 B 3 30 300 0.0282928 9999 C 1 174 92 2999.4514 9999 APEW-1 2 174 92 54.952499 9999 ART-3A 1 174 97 5352.1299 9999 APEW-2 1 173 128 40.455467 9999 APEW-3 2 173 128 1291.1320 9999 APEW-3 3 173 128 86.562599 9999 ART-7B ... I want to create a dictionary that looks like below (basically skipping the header and certain columns and goes to the data that I need):

Creating a dictionary from text file Python Numpy

梦想与她 提交于 2019-12-24 05:46:02
问题 I have a text file that looks like this: # Comments PARAMETER 0 0 1045 54 1705 0 time 1 1 10 100 0.000e+00 9999 A 2 20 200 0.2717072 9999 B 3 30 300 0.0282928 9999 C 1 174 92 2999.4514 9999 APEW-1 2 174 92 54.952499 9999 ART-3A 1 174 97 5352.1299 9999 APEW-2 1 173 128 40.455467 9999 APEW-3 2 173 128 1291.1320 9999 APEW-3 3 173 128 86.562599 9999 ART-7B ... I want to create a dictionary that looks like below (basically skipping the header and certain columns and goes to the data that I need):

Matlab .txt file analyses

旧巷老猫 提交于 2019-12-24 05:40:10
问题 I am analyzing a set of text in a .txt file. the file has 30 lines and each line contains different phrases both containing text, numbers, and symbols. what's the best way to import this file into Matlab for analyses (i.e.: how many Capital I's are in the text file or how many #text phrases are in the file (analyzing tweets on each line) 回答1: I think you'd best read the file line-by-line and save each line in a cell of a cell array: fid = fopen(filename); txtlines = cell(0); tline = fgetl(fid