extract

in matlab, calculate mean in a part of one column where another column satisfies a condition

别说谁变了你拦得住时间么 提交于 2019-12-12 14:00:03
问题 I'm quite new to matlab, and I'm curious how to do this: I have a rather large (27000x11) matrix, and the 8th column contains a number which changes sometimes but is constant for like 2000 rows (not necessarily consecutive). I would like to calculate the mean of the entries in the 3rd column for those rows where the 8th column has the same value. This for each value of the 8th column. I would also like to plot the 3rd column's means as a function of the 8th column's value but that I can do if

Python - Extracting a substring using a for loop instead of Split method or any other means [duplicate]

妖精的绣舞 提交于 2019-12-12 13:29:33
问题 This question already has answers here : Splitting input into two with for-loop (2 answers) Closed 6 years ago . I'm taking an online Python course which poses a problem where the programmer is to extract a substring using a for loop. There was a similar question asked a year ago, but it didn't really get answered. So the problem reads: Write a program that takes a single input line of the form «number1»+«number2», where both of these represent positive integers, and outputs the sum of the

Parsing txt files and extracting information in R

你。 提交于 2019-12-12 12:38:02
问题 I need to extract information from text files with varying structure between files. Whilst this can be done using a macro, as the files are variable, selecting by line no. and spacing within a line is not successful for all files. I was wondering if anyone could tell me if there is a way of parsing txt files and searching by keyword and extracting information after the keyword? For example something like Flow Rate: 99.99, I would want to extract the 99.99. Another issue with this that, using

MYSQL extract json elements where the json contains

旧巷老猫 提交于 2019-12-12 10:24:58
问题 I'v got table orders with orders . items as JSON example of orders . items cell: { "10": { "name": "item 1", "step": "1", "price": "140", "amount": "4", "category": "9" }, "24": { "name": "item 2", "step": "1", "price": "6.2", "amount": "1", "category": "5" }, "35": { "name": "item 3", "step": "1", "price": "2.9", "amount": "3", "category": "1" }, "37": { "name": "item 4", "step": "1", "price": "3.9", "amount": "2", "category": "9" } } i want to extract only items that in specific category

iOS PDF to plain text parser

自古美人都是妖i 提交于 2019-12-12 10:14:04
问题 I'm quite at a lost on this subject. I've read pretty much every post about it here on SO, I would very much appreciate it if somebody would nudge me in the right direction. I have a PDF and I would like to extract it's text, I'm only interested in words and spaces. I have setup a CGPDFScanner and it's callback methods. What I have read is that I only need to consider 4 operators TJ, Tj, qout(') and doubleqout(") as far as extracting text goes. I guess I also need to keep track of the text

Extracting a .app from a zip file in Python, using ZipFile

冷暖自知 提交于 2019-12-12 10:02:30
问题 I'm trying to extract new revisions of Chromium.app from their snapshots, and I can download the file fine, but when it comes to extracting it, ZipFile either extracts the chrome-mac folder within as a file, says that directories don't exist, etc. I am very new to python, so these errors make little sense to me. Here is what I have so far. import urllib2 response = urllib2.urlopen('http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST') latestRev = response.read() print

Extract number between brackets in Excel?

情到浓时终转凉″ 提交于 2019-12-12 09:41:13
问题 I've been searching up and down for an answer to this, but haven't found anything I can get to work. It may well be my lack of knowledge in the more "codey" aspects of Excel. Anyway, this is my situation: In C2-C17, I have some text set up like this:[2] Name of job. The "[2]" indicates the hours we expect the assignment to take, the rest is the name of the assignment. Now I need to calculate how many hours all this adds up to, so in B2-B17 (the numbers will change) I would like to extract the

extract from {raster} package using excessive memory

江枫思渺然 提交于 2019-12-12 08:15:50
问题 I have been using the extract function from the raster package to extract data from raster files using an area defined by shapefiles. However, I am having problems with the amount of memory that this process is now requiring. I do have a large number of shapefiles (~1000). The raster files are large (~1.6gb) My process is: shp <- mclapply(list.files(pattern="*.shp",full.names=TRUE), readShapePoly,mc.cores=6) ndvi <- raster("NDVI.dat") mc<- function(y) { temp <- gUnionCascaded(y) extract <-

Javascript regex - how to get text between curly brackets

血红的双手。 提交于 2019-12-12 07:18:58
问题 I need to get the text (if any) between curly brackets. I did find this other post but technically it wasn't answered correctly: Regular expression to extract text between either square or curly brackets It didn't actually say how to actually extract the text. So I have got this far: var cleanStr = "Some random {stuff} here"; var checkSep = "\{.*?\}"; if (cleanStr.search(checkSep)==-1) { //if match failed alert("nothing found between brackets"); } else { alert("something found between

Extracting one text files from multiple zip archives in R

假装没事ソ 提交于 2019-12-12 05:49:31
问题 I am trying to extract one text file from each of the zip files located in one folder. Then I want to combine those text files into one dataframe. The folder has multiple Zip files: pf_0915.zip pf_0914.zip pf_0913.zip ..... Inside of those zip files are multiple text files. I am only interested in the one called abc.txt. This is a fixed width format file without header. I have already set up a read for this file using read_fwd. Since all the extracted text files have the same name, it might