LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make this subVI faster

Solved!
Go to solution

Dear all

 

I have a subVI which tries to estimate "sample entropy" it works OK but it is too slow. I was wondering if you have any suggestion on my VI how I can speed it up. I attached the files here I would be grateful if you take a look.

 

Best regards

 

Afshin

0 Kudos
Message 1 of 11
(3,212 Views)

Afshin,

 

I found several little things, but they probably do not make much difference.  Moving calculations and controls outside loops when the inputs will not change within the loop can help.  I have attached some of the changes.

 

I suspect that some of the array manipulations can be simplified, but I am not sure what you are trying to do.  Please post a VI with some typical data saved as default.  Also indicate what the function or procedure being implemented is.

 

How long does your VI take and how fast would you like it to be?

 

Lynn 

0 Kudos
Message 2 of 11
(3,170 Views)

Dear Lynn

 

Thank you for your attention and good advices.

I attached the main subVI with saved default values. "Repmat" is supposed to repeat the input array "Dim1" times along the first dimension and "Dim2" times along the second dimesio. It should be similar to what "repmat"in MATLAB does. Obviously "Max on Row"finds the max of each row on input matrix.

For the default input which is 1500 samples long it takes arround 2 second but I would like to have it like at least half as much.

 

thank you again for your attention.

 

BR

Afshin

Message 3 of 11
(3,139 Views)

Hi Afshin,

 

Good afternoon and I hope your well today.

 

Thanks for the post!

 

I have been looking about these function from the Mathworks pages.  I have created a LabVIEW example which generates this outcome in next to no time.  I have asked a few of the team to take a look, and we could think of any more efficent methods or rules you could apply to simplifer the computation required i.e. if you want to repeat it x by y times then x + y alterations are required. 

 

How large is your input array (m x n) ? 

 

The code I have attached is in LabVIEW 8.6 and includes benchmarking - so give it ago. And I will run the same test on my machine. If you are using a different version of LabVIEW just let me know, and I'll repost the code. 

 

What sort of machine are you running your code on?

 

Please let me know how this finds you and I hope it helps, 

 

Message Edited by Hillman on 06-16-2009 12:39 PM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 4 of 11
(3,123 Views)

Hi

Thanks a lot! Actually I use LV 8.2.1 so I would be grateful to have compatible with that in my case the input is not that big I have only two channels which I estimate the sample entropy for each of them and in each channel I have about 6000 samples at each execution.

 

Thanks again. It is a great help.

 

Regards

Afshin

0 Kudos
Message 5 of 11
(3,116 Views)
Solution
Accepted by topic author Af_Dk

Hi Afshin,

 

Good Afternoon and I hope your well today. 

 

Here is the code in LabVIEW 8.2.1. I have tested it and it works the same. 

 

If you could test it against your code / and then tell me what test you did and the times it took on your machine. I dont mind doing the same, and see if my machine was just faster or if maybe your code is using a different method. 

 

Let me know!& maybe consider the kudos button 🙂

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 6 of 11
(3,110 Views)

thank you again!

 

I think the most time cosuming part of my VI is the nested loop which is too long although your codes are a bit of modification but still it is slow. I work on a machine with Intel (dual core) 2.1 GHz and 1 GB RAM with windows XP. Now I changed the algorithm to have a rough estimate of what I was calculating but in proper time so once again thank you.

 

BR

Afshin

0 Kudos
Message 7 of 11
(3,102 Views)

I pressed the kudos button several times but I don't know why it is  not working!

 

0 Kudos
Message 8 of 11
(3,100 Views)

Hi Afshin,


Thanks for your prompt reply and I hope your well.

 

To leave kudos you must be signed in - did you check this? But then you must of been to select a solution. Maybe try another time if you wish. 😉

 

I think you have a large number of datapoints so a bit of time would need to be taken. Do you know how long this function takes in Matlab?

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 9 of 11
(3,093 Views)

Hi

 

Yes I am logged in and I also approved the solution but still when I press it does not do anything.

 

 

BR

Afshin

0 Kudos
Message 10 of 11
(3,090 Views)