Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

09-02-2018 07:58 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Labels:

Hi guys,

I'm creating a program for the evaluation of the dynamic behavior of supercapacitor and to achieve my goal I have a really long array with thousands of point.

To reshape this array I create many submask using the Labview blocks of "reshape array" and so on but to do that for all points is quite a mess.

The process that I have to follow is this:

Split the main array in subgroups of 100 points, take the mean value of this 100 points and finally create a new array made of mean values.

Could you help me to do this with only one mathscript instead of hundreds of submask and stuff like that?

09-02-2018 10:33 AM - edited 09-02-2018 11:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

- There is no Mathscript anywhere on your diagram, so I don't understand the question.
- LabVIEW has a "reshape array" function and I don't see that either.
- You did not attach any of your subVIs.
- Why do you have all these different subVIs? Don't they all do the same thing?
- Did you know that "index array" is resizeable?
- Typically, dataflow should be left-to-right, not in all possible direction. It is hard to understand the program without doing a cleanup first.
- there is no need for dynamic data and express VIs. XY graphs understand simpler datatypes, e.g. 1D complex arrays.
- Why do your subVI have such random and unintuitive names?
- ...

Can you reduce your VI to a simple example, then explain what the output should look like?

09-02-2018 10:46 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

You have a 1D array with many points, and want to form a new array consisting of the mean of each set of 100 points. You can do the entire thing with a few LabVIEW functions and a For loop.

- Assume your 1D array has N elements. If you don't know in advance the size of the array, use Array Size to find N.
- Use Reshape Array to make a new array having 100 columns and N/100 rows. Both the number of Columns and number of Rows need to be integers -- I'll leave it to you to think about how you want to handle things if N isn't evenly divisible by 100.
- Now you have a 2D array whose rows are sets of 100 elements of the original Array. Run this into a For loop, whose indexing Tunnel will give you a row. Pass this through the Mean function and output the Mean through another indexing Tunnel to give you the desired Array of Means.

You should be able to write this code from the above description. I hope you do so before someone thoughtlessly posts the code.

Bob Schor

09-02-2018 11:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thank you so much for your reply, I'm going to try to do like you say because i think it's really a good idea! Thanks again for now!

Simone Guidi

09-02-2018 11:07 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Here's a simple VI that does about the same as yours. Arguably simpler. 😄

09-02-2018 11:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Bob_Schor wrote:

You should be able to write this code from the above description. I hope you do so before someone thoughtlessly posts the code.

I did not see Bob's message, but I don't think my post was thoughtless. It contained sufficiently obscure modifications that will allow you to learn about datatypes and array operations. In fact if you put in some effort to fully understand it, it will put you on a fast track to become a better programmer. You will also appreciate how elegant and powerful LabVIEW is! 😄 Enjoy!

09-02-2018 07:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Anything by Altenbach is never thought__less__, but thought__ful__. Not all posters, however, are as knowledgable and generally helpful as he -- as I generally try to do, he also is interesting in __teaching__ others about LabVIEW, not showing how clever he is.

Bob Schor