rows

Matlab number of rows in excel file

房东的猫 提交于 2019-12-10 14:29:37
问题 is there a command of Matlab to get the number of the written rows in excel file? firstly, I fill the first row. and then I want to add another rows in the excel file. so this is my excel file: I tried: e = actxserver ('Excel.Application'); filename = fullfile(pwd,'example2.xlsx'); ewb = e.Workbooks.Open(filename); esh = ewb.ActiveSheet; sheetObj = e.Worksheets.get('Item', 'Sheet1'); num_rows = sheetObj.Range('A1').End('xlDown').Row But num_rows = 1048576, instead of 1. please help, thank you

How can I check if a database query will return results?

六眼飞鱼酱① 提交于 2019-12-10 14:15:26
问题 Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing people circumvent their in-house IT team! I need to make a simple change to this application. Currently, the vacancies page says 'We currently have the following vacancies:', regardless of whether there are any vacancies!

MySQL - Sum only if all rows are not null, else return null

流过昼夜 提交于 2019-12-10 12:44:18
问题 Let's suppose the following table: X VALUE 1 2 1 3 2 NULL 2 4 I want a result set grouped by X with the sum of VALUE, but only if all the rows related to each X value are not null. Using the same example, the result must be: X SUM(VALUE) 1 5 As you can see, X=2 is not selected due to the (2, NULL) tuple. I want, whenever this is possible, without using subqueries. Thank you very much! 回答1: You can achieve that with: SELECT x, SUM(value) FROM t GROUP BY x HAVING COUNT(value)=COUNT(*) This will

Add new column to data.frame based on rows grouped by episodes of specific days' length

南楼画角 提交于 2019-12-10 12:26:46
问题 df = read.table(text = 'ID Day Count Count_sum 33021 9535 3 29 33029 9535 3 29 34001 9535 3 29 32010 9534 2 29 33023 9534 2 29 45012 9533 4 29 47001 9533 4 29 48010 9533 4 29 50001 9533 4 29 49004 9532 1 29 9002 9531 2 29 67008 9531 2 29 40011 9530 1 29 42003 9529 2 29 42011 9529 2 29 55023 9528 1 29 40012 9527 3 29 43007 9527 3 29 47011 9527 3 29 52004 9526 4 29 52005 9526 4 29 52006 9526 4 29 52007 9526 4 29 19001 9525 1 29 57008 9524 5 29 57010 9524 5 29 58006 9524 5 29 58008 9524 5 29

geom_raster faceted plot with ggplot2: control row height

蓝咒 提交于 2019-12-10 10:35:31
问题 In the example below I have a dataset containing two experiments F1 and F2. A classification is performed based on F1 signal, and both F1 and F2 values are ordered accordingly. In this diagram, each facet has the same dimension although the number of rows is not the same ( e.g class #7 contains only few elements compare to the other classes). I would like to modify the code to force row height to be the same across facets (facets would thus have various blank space below). Any hints would be

How to count duplicate values in cakephp?

最后都变了- 提交于 2019-12-10 10:29:09
问题 I need to find out how many times each value is duplicated. Here's what I've got so far. I'd like to use it for counting votes in polls. $this->set('votes', $this->Answer->Vote->find('all', array( 'fields' => array('Vote.answer_id'), 'group' => array('Vote.answer_id HAVING COUNT(*) > 1')))); And it returns me which values are duplicated, like this: 1st answer 2nd answer 4th answer But I still need the number, to show how many times it's duplicated. Something like this. 1st answer (5) 2nd

Assigning values in a sequence to a group of consecutive rows leaving some rows empty

烈酒焚心 提交于 2019-12-10 10:27:23
问题 I'm trying to group several consecutives rows (and assigning them the same value) while leaving some of the rows empty (when a certain condition is not fulfilled). My data are locations (xy coordinates), the date/time at which they were measured, and the time span between measures. Somehow simplified, they look like this: ID X Y Time Span 1 3445 7671 0:00 - 2 3312 7677 4:00 4 3 3309 7680 12:00 8 4 3299 7681 16:00 4 5 3243 7655 20:00 4 6 3222 7612 4:00 8 7 3260 7633 0:00 4 8 3254 7641 8:00 8 9

Matlab - insert/append rows into matrix iteratively

余生颓废 提交于 2019-12-10 02:43:39
问题 How in matlab I can interactively append matrix with rows? For example lets say I have empty matrix: m = []; and when I run the for loop, I get rows that I need to insert into matrix. For example: for i=1:5 row = v - x; % for example getting 1 2 3 % m.append(row)? end so after inserting it should look something like: m = [ 1 2 3 3 2 1 1 2 3 4 3 2 1 1 1 ] In most programming languages you can simply append rows into array/matrix. But I find it hard to do it in matlab. 回答1: m = [m ; new_row];

Printing 2 evenly populated lists side by side evenly

此生再无相见时 提交于 2019-12-09 17:10:33
问题 I'm using the following code to produce 2 lists, nameList and gradeList. nameList[] gradeList[] for row in soup.find_all('tr'): name = row.select('th strong') grade = row.select('td label') if grade and name: if "/" in grade[0].text: gradeList.append(grade[0].text) nameShort = re.sub(r'^(.{20}).*$', '\g<1>...', str(name[0].text)) nameList.append(nameShort) Producing something like: nameList = [“grade 1”,”grade 2222222222”,”grade 3”] gradeList = [“1/1”,”2/2”,”100000/100000”] I want the program

How to convert multiple columns to individual rows in R

给你一囗甜甜゛ 提交于 2019-12-09 06:30:23
问题 I have a data frame in R that has many rows (over 3000) with F0 (fundamental frequency) tracks of an utterance in it. The rows have the following information in them: speaker ID, group #, repetition #, accent type, sex, and then 50 columns of F0 points. The data looks like this: Speaker Sex Group Repetition Accent Word 1 2 3 4 105 M 1 1 N AILMENT 102.31030 102.31030 102.31030 102.31127 105 M 1 1 N COLLEGE 111.80641 111.80313 111.68612 111.36020 105 M 1 1 N FATHER 124.06655 124.06655 124.06655