cumsum
Hello
I want to generate a vector that is the cumulative sum of another vector without using a loop. My vector is more than 10 ^ 6 length and a loop takes forever. I use cumsum in matlab, but could not find something similar in labview.
Thank you!
It works for a 1 d of 1 million items table... you need to mod a little for a 2d array but it takes hardly any time at all to run. You must have an inefficiency in your code. If you make columns or lines, I can mod a bit for you, but you should try it on your own first using this example.
Tags: NI Software
Similar Questions
-
I have a question about the terms of fenestration.
Given a simple table abc (id integer, integer id_size) with values like
1 17
2 117
3 0
4 100
...
My question is: would you please give me all the min (id) where the sum (id_size) > n * 100.
So for the values indicated above, the result would be 2 4...
My first approach was this:
with get_cumsum as
(select id, id_size, sum (id_size) more
(order by id lines between unlimited above and the current line) CumSum of ABC)
Select min (id) in the get_cumsum where cumsum > UNION 100
Select min (id) in the get_cumsum where cumsum > union 200
...
But unfortunately I do not know in advance up to what amount will my data.
Are there any ideas how to solve this problem (both in Oracle 11 and Oracle 9).
Thanks for your help, HannesHello
Use GROUP BY aggregation: it is how many groups there is and gives you a separate result for each of them.
WITH s AS ( ... -- Your original query ) SELECT 100 * FLOOR (comsum / 100) AS grp_num , MIN (id) FROM s GROUP BY FLOOR (comsum / 100) ORDER BY FLOOR (comsum / 100);
Or calculate
100 * FLOOR (comsum / 100) AS grp_num
in a second subquery and use grp_num of the main request.
Maybe you are looking for
-
I had made some changes to Firefox this morning, including change the start page of Outlook. Now as soon as Firefox gets up and starts Outlook, it freezes. I can not even Firefox options to reset the.
-
How can I activate audio in safe mode XP network?
Is it possible to have audio with youTube videos when I boot to "safe mode networking" under XP? Thank you Dr
-
We have a remote access VPN, using Cisco VPN client in our test environment. Everything works fine. We were able to connect to the Cisco VPN client and access to internal resources. However, we want to copy the same configuration on an another SAA
-
Transfer of Photoshop to new laptop
My old laptop with Photoshop has crashed and I have more serial number. I moved the program files on my hard drive. Is there anyway that I can download my photoshop existing to my new computer? Thank you.
-
How to check which computer sing in adobe cc?
Because I have allredy instal cc in both computers, but one of them that I can't get in because it's broken and I need to install in my new computer, but I can't