Go to Post Even at Mc Donalds, dinner with Dean would be really cool! - Josh Hambright [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-10-2016, 18:15
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Google Sheets OPR Calculator

Quote:
Originally Posted by Rachel Lim View Post
the array must be a consistent size, so I had to keep the loop to create T so I could initialize A.
Can't you simply initialize A with a single command (no looping) to a size greater than what you expect is needed? And when you so initialize it, doesn't it set all the array elements to zero (some languages do)?

Quote:
It also seems like fill() doesn't work in scripts,
I find it hard to imagine the script language provides no way to zero an array without looping through all its elements.

Quote:
so I had to loop through T to set A to zero
why do you need to "loop through T" to set A? Just initialize the entire array A to zero before beginning the processing of the 8col data

Quote:
otherwise when I printed out A...
I meant to ask this earlier: What does "print out" mean in this context, and why do you need to do that?

Quote:
It also results in the OPRs not being sorted, which is a convenience I'd sacrifice a bit of time for.
Please read my earlier post#15 in this thread.


Quote:
Hopefully that now addresses your point?
Not really. But if you're satisfied with what you have I won't bug you



Last edited by Ether : 28-10-2016 at 18:21.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-10-2016, 18:18
Rachel Lim Rachel Lim is offline
Registered User
FRC #1868 (Space Cookies)
Team Role: Student
 
Join Date: Sep 2014
Rookie Year: 2014
Location: Moffett Field
Posts: 244
Rachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond reputeRachel Lim has a reputation beyond repute
Re: Google Sheets OPR Calculator

Quote:
Originally Posted by Ether View Post
Can't you simply initialize A with a single command (no looping) to a size greater than what you expect is needed? And when you so initialize it, doesn't it set all the array elements to zero (some languages do)?
I could do something like set A to the number of matches. I'm not sure if it's really worth it, or how much longer it'd take to set that many cells, but I guess that's the alternative.

Array values are set to null (I think--if I set a cell value to that, it comes out as either "undefined" or "NOT_FOUND" depending on whether I set an individual cell or range)

Quote:
I find it hard to imagine the script language provides no way to zero an array without looping through all its elements.
I think javascript has 2 ways to do that: fill() and apply(), neither of which seems to work in google scripts.

Quote:
why do you need to "loop through T" to set A? Just initialize the entire array A to zero before beginning the processing of the 8col data
Each row of A is T elements long, and I need to set each value to 0. I can't find another way to do it (see above).

Quote:
I meant to ask this earlier: What does "print out" mean in this context, and why do you need to do that?
Setting the cells in a certain range to those values (using .getRange().setValues()). Basically google sheets has matrix formulas but google scripts doesn't seem to have an equivalent, so it's easier for me to put the matrices into a sheet, set the formula, and do the final calculations directly in the spreadsheet.


Quote:
Please read my earlier post#15 in this thread.
I know I can sort it after, or set an equation to create another column sorted, but it makes it more complicated.

Quote:
Not really. But if you're satisfied with what you have I won't bug you
I understand the reason to optimize it further, but in this case I think I'll spend the time adding in some additional functionality (like importing data automatically, multiple components, etc.). I never intended this to replace other, faster methods of calculating OPR, since other languages (especially matlab/octave) are just inherently faster at these calculations. I was mainly looking for an easy method where I could ask someone at a competition to run it without them needing to do more than type in values / press a button, and get a sorted list out of it.

This has been an interesting conversation though, so thank you for that.



I will be updating the posted spreadsheet with the new script soon (currently cleaning it up a bit, but it should be up by tonight) for anyone who wants it.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:07.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi