max

VBA Range.Find() function not working with large floating numbers

六月ゝ 毕业季﹏ 提交于 2019-12-24 07:44:10
问题 I am writing code to lookup the highest dollar amount in a column and bring back the value as well as the value of cells in adjacent columns with 9 char in the target cell When I set the range variable it shows the value of "12000.88" which works fine, however as soon as that value extends to over 9 digits "123000.55" the "set fnd" doesn't find it and the range variable is Nothing. I have tested many other things and have found the only difference is the length of the value Sub Populate() Dim

VBA Range.Find() function not working with large floating numbers

删除回忆录丶 提交于 2019-12-24 07:43:10
问题 I am writing code to lookup the highest dollar amount in a column and bring back the value as well as the value of cells in adjacent columns with 9 char in the target cell When I set the range variable it shows the value of "12000.88" which works fine, however as soon as that value extends to over 9 digits "123000.55" the "set fnd" doesn't find it and the range variable is Nothing. I have tested many other things and have found the only difference is the length of the value Sub Populate() Dim

Find max indices in octave

余生颓废 提交于 2019-12-24 07:30:07
问题 I have nx4 matrix. I need to find max value and it's index. I use [mVal,mInd]=max(A,[],2) When a row contains same value more than once and it is the max value I need to find all indices of the row. Example: Say A(10,:) is [-1.2 1.6 1.6 1.6] I need to return 2,3,4 as indices. 回答1: Try this: A(10,:)=[-1.2 1.6 1.6 1.6]; [i,j]=find(A==max(max(A))) The row indices of the maxima should be in the vector i , the column indices in j . 来源: https://stackoverflow.com/questions/29769580/find-max-indices

MySql SELECT only newest message from distinct threads order by timestamp -Private Messages Inbox Similar to Facebooks(2013)

馋奶兔 提交于 2019-12-24 05:59:34
问题 Trying to recreate a private message system similar to what Facebooks setup these days. The part im having a problem with is SELECT only newest message from distinct threads order by timestamp. Here is the closest query I could come up with so far. The problem is the inbox should only return one row for each thread and currently my query returns multiple rows from the same thread: SELECT m.created_on, m.thread_id, m.message_id, m.created_by, m.body, u.first_name, u.last_name, u.thumb_img FROM

python replace values in 2d numpy array

妖精的绣舞 提交于 2019-12-24 04:30:09
问题 I want to replace the max values of each column of a 2d numpy array with -1: b = numpy.array([[1,2,3,4],[5,6,7,8], [9,10,11,12]]) #get the max value of each column maxposcol = b.argmax(axis = 0) maxvalcol = b.max(axis = 0) #replace max values with -1 for i in numpy.arange(b.shape[1]): b[maxposcol[i]][i] = -1 Is there any other way to replace the max values whose positions are given by maxposcol[i]? If I want to find the n maximal values of each column of my matrix what would you advise me to

python: max value in a dictionary with 2 keys

南楼画角 提交于 2019-12-24 01:57:24
问题 I have a dictionary D set up as D={('a','b'):['1000','5','.3'], ('c','d'):['2000','8','-.8']} where ('a','b') and ('c','d') are the keys. I am having trouble finding the maximum of the first values in the lists. So in using max(D) I need it to return ('c','d'). Keep in mind my list is hundreds of pairings. I just need to have the max() function be able to recognize the first value '2000' and '1000' and find the maximum of those. Any help or suggestions would be greatly appreciated. 回答1: You

C# Entity Framework select max after where filter of not nullable field

北慕城南 提交于 2019-12-24 00:47:31
问题 I have a not nullable field ( Num ) class MyTable { //... public int Num { get; set; } public string Category { get; set; } //... } want to find maximum Num for Category == "A" var maxnum = myTable .Where(r => r.Category == "A") .Max(r => r.Num); the problem occurred when there wasn't any record of category == "A" . Because the result of Where() is null so the result of Max() will be null but when Num is not nullable the exception occurred. I can fix it by setting Num as nullable in table

Atomic max for floats in OpenCL

不打扰是莪最后的温柔 提交于 2019-12-23 23:54:04
问题 I need an atomic max function for floats in OpenCL. This is my current naive code using atomic_xchg float value = data[index]; if ( value > *max_value ) { atomic_xchg(max_value, value); } This code gives the correct result when using an Intel CPU, but not for a Nvidia GPU. Is this code correct, or can anyone help me? 回答1: You can do it like this: //Function to perform the atomic max inline void AtomicMax(volatile __global float *source, const float operand) { union { unsigned int intVal;

Finding most common values in each column

冷暖自知 提交于 2019-12-23 22:25:06
问题 Below is what I have in table myTable . +--------+--------+--------+--------+ | value1 | value2 | value3 | value4 | +--------+--------+--------+--------+ | 9 | 4 | 3 | 3 | | 1 | 2 | 9 | 3 | | 1 | 2 | 3 | 4 | | 1 | 2 | 3 | 4 | +--------+--------+--------+--------+ I want output as +--------+--------+--------+--------+ | value1 | value2 | value3 | value4 | +--------+--------+--------+--------+ | 1 | 2 | 3 | 4 | +--------+--------+--------+--------+ value1=1 because 1 is thrice in that column.

Max over multiply columns

流过昼夜 提交于 2019-12-23 20:07:03
问题 I've got a little problem: In my table I have these rows: PersHist : ID Date Histroy 1 01.01.2008 0 1 01.01.2008 1 1 01.01.2008 2 1 02.01.2008 0 1 02.01.2008 1 Now when I do a select like: SELECT max(date), max(Histroy) FROM PersHist WHERE ID = 1 I'm getting this output: ID Date Histroy 1 02.01.2008 2 This is false because there is no 02.01.2008/2 (Date/Histroy) Is it possible to write a simple SQL that will get me 02.01.2008/1 without writing subqueries? 回答1: Try this. It will take all