Right now, I am trying to pass this for a dataset sample:
7/2/2014,7:30,138.885,138.87,138.923,,,,138.88067,138.91434,138.895,,,,138.89657 14,138.9186042,138.8745387,138.923,138.9046667,138.895,138.8696667
But predictably, it gives me a value error since empty strings can't be converted into floats. What I want to do is to pass those empty variables in such a way the associated nodes will do nothing at all, or there won't be a learning, nothing will change etc.
Is there any way to do this?
(There is method for converting the timestaps, I just need to handle the empty strings)
There are a number of ways, but one is to calculate the average value of that column, and pass that in any case where there is missing data. You can also add a column that is True/False for whether or not the data is present, so that the network has the ability to learn that the first column is important only when the second column is True.
Related
I am trying to create a new reference containing another reference as in ${var${randnum}}.
Ultimately, I want to create a variable which refers to a two times two randomized set of variables.
As the above approach did not work, I developed it further with below result.
In the calculate field I write
concat('$','{','trust',${rand_no2},'_' ,${rand_no3_1},'}')
Which should result in
${trust1_1}
and respective combinations.
Without line 11 (name=ref2) the file compiles and I can start it in ODK Collect (v.2.4) on my phone. When I reach line 10 (in ODK Collect), however, I receive the message:
"Error Occured
Dependency cycle in s; recursion limit exceeded!!"
(I included line 11 to show what I want to do in the end.)
I am writing the file in Excel and compile it with ODK xlsform offline. (For testing I transfer it via cable to my phone.)
The xls file for reproduction can be found here:
https://forum.getodk.org/t/concatenate-references-to-create-new-reference-var-randnum/34968
Thank you very much in advance!
You're mixing up some things related to the ${q} syntax, question names and question values.
Note that ODK Collect does not actually understand the ${q} syntax (which is XLSForm-only). It's helpful to look at the actual form format that ODK collect understands which is called XForm, an XML format that XLSForm converts into. However, even if ODK Collect understood the ${q} syntax, your approach still wouldn't work since you're creating a string value for the ref question (using concat). This wouldn't magically be evaluated as a reference / formula. You cannot dynamically create a reference or formula.
At the moment (until ODK supports something like the local-name() function), maybe the best approach is to use position and put the calculated values inside a group. Something like //group/calc[number(${pos})] perhaps. Note that positions are 1-based (so the first item is position 1) and casting the position to a number or integer is required.
I am wondering if it is possible - using an Excel formula (no vba) - to loop through a list with values and check if those values are in another list. The idea is to use this to come up with a sum pulling data from the first list while the second list sets the conditions. Please see below picture. I was thinking that this might work with sumproduct including an if-statement. Any ideas?
This should work (F1):
=SUM(SUMIF(Table1[Item],Table2[Included],Table1[Amount]))
but you may need to array-enter it or use SUMPRODUCT instead of SUM in pre-365 versions of Excel.
If you wanted to match ? literally rather than as a wild card standing for any single character you would need F2:
=SUM(SUMIF(Table1[Item],SUBSTITUTE(Table2[Included],"?","~?"),Table1[Amount]))
and similarly for *.
I'm trying to read amplitude from a waveform and shine a green, yellow or red light depending on the amplitude of the signal. I'm fairly new to labVIEW and couldnt get my idea that wouldve worked with any other programming language I know to work. What I'm trying to do is take the value of the signal and for everytime it updates I'll store the value of the amplitude into an index of a large array. With each measurement being stored in the n+1 index of the array.
After a certain amount of data points I want to start over and replace values in the array (I use the formula node with the modulus for this). By keeping a finite amount of indexes to check for max value I restrict my amplitude check to a certain time period.
However my problem is that whenever I use the replace array subset to insert a new value into index n, all the other index points get erased. Rendering it pretty much useless. I was thinking its the Initialize array causing problems but I just cant seem to wrap my head around what to do here.
I tried creating just basic arrays in the front panel, but those either are control or indicator arrays and can't seem to be both written and read from, its either control (read but not write) or indicate(write but not read)?. Maybe its just not possible to do what I had in mind in an eloquent way in LabVIEW. If its not possible to do this with arrays in LabVIEW I will look for a different way to do it.
I'm pretty sure I got most of the rest of the code down except for an unfinished part here and there. Its just my issue with the arrays not working as I want them too.
I expected the array to retain its previously inputted data for index n-1 when index n is inputted. And only to be replaced once the index has come back to that specific point.
Instead its like a new array is initialized every time a new index is input.
download link for the VI
What you want to do:
Transport the content of the modified array into the next iteration of the WHILE loop.
What happens:
On each iteration, the content of the array is the same. It is the content of the initial array you created outside.
To solve this, right-click the orange square on the left border of the loop, and make it a "shift register". The symbol changes, and a similar symbol appears on the right border. Now, wire the modified array to the symbol on the right. What flows out into that symbol on the right, comes in from the left symbol on the next iteration.
Edit:
I have optimized your code a little. There is a modulo function, and an IF clause can handle ranges. ..3 means "values lower or equal 3". The next case is "Default", the next "7..". Unfortunately, this only works for integers. Otherwise, one would use nested IF clauses with the < comparator or similar.
Given the following table:
I would like the Actual Start to show the Preferred Start value, if the Depends column is empty (easy).
If the Depends column contains one or more comma-separated Id values, I would like to split on comma, look up the array of "Preferred Start" values based on the corresponding Id value, and then select the maximum value.
The following formula will correctly split the "Depends" cell:
=FILTERXML("<t><s>"&SUBSTITUTE(G6,",","</s><s>")&"</s></t>","//s")
Which can be verified, by using an array-valued MAX function (this returns "4"):
={MAX((FILTERXML("<t><s>"&SUBSTITUTE(G6,",","</s><s>")&"</s></t>","//s")))}
However, what I really want to do is:
={MAX(INDEX(Table1[Preferred Start],MATCH((FILTERXML("<t><s>"&SUBSTITUTE(G6,",","</s><s>")&"</s></t>","//s")),Table1[Id],0)))}
Somewhere along the way however, it loses the "arrayness", and simply returns the "Preferred Start" of the first Id number of the split (Id 3, 17 Jan 18).
Is what I'm trying to do even possible without resorting to VBA? I suspect I will run into a circular reference in actuality, since I really need to take the maximum of the "Actual Start" (adjusted for dependencies), to properly cascade a chain of dependent items.
Thanks
This is a known issue with INDEX, it's reluctant to return an array without some co-ercion. Generically this should work
=INDEX(range,N(IF(1,{array})))
so that becomes the following with your specific scenario
=MAX(INDEX(Table1[Preferred Start],N(IF(1,MATCH((FILTERXML("<t><s>"&SUBSTITUTE(G6,",","</s><s>")&"</s></t>","//s")),Table1[Id],0)))))
confirm with CTRL+SHIFT+ENTER
I assume that every row has a different ID number because the MATCH function will only find the first match for each ID
....or for a completely different approach you can use AGGREGATE function (and SEARCH instead of FILTERXML), which doesn't require "array entry" and would return the correct MAX even if IDs repeat, i.e.
=AGGREGATE(14,6,Table1[Preferred Start]/SIGN(SEARCH(","&Table1[Id]&",",","&G6&",")),1)
Reorder the match to include the max in it:
=INDEX(Table1[Preferred Start],MATCH(MAX((FILTERXML("<t><s>"&SUBSTITUTE(G6,",","</s><s>")&"</s></t>","//s"))),Table1[Id],0))
Enter as an array formula using Ctrl-Shift-Enter.
I apologise if this is a very simple question, but I am at a bit of a loss here.
A bespoke formula I want to use returns an array of values, as seen here:
But I cannot find a way to present this output in a cell separated format, only the first cell (39478) is returned.
There is a note included in the documentation: Hint: This function is a multiple result function. You MUST set an array for the output.
Whilst I understand I am going to need an array to display multiple results, I cannot find the method of doing so. Any tips?
If the bespoke formula wants to return an array of values, there are a couple of ways to get the results into multiple cells.
Put the formula into a cell and hit Enter↵. Next, select that cell along with several cells below it. Tap F2 then hit Ctrl+Shift+Enter↵. The successive values should fill the cells selected until an error (no more returns) is reached.
Put that formula into a cell and hit Ctrl+Shift+Enter↵. The formula should be wrapped in braces (e.g. { and }). If the correct relative and absolute cell addresses were used (e.g. $**A$1 or $**A1, etc) then you should be able to fill, copy or drag down the formula into successive rows.
Use an INDEX function to contain the array of returned values from the bespoke formula and peel off successive values using the row_num parameter. =INDEX(<bespoke formula>, ROW(1:1)) Filled down.
Sooner or later, you will run out of rows to fill. An IFERROR function used as a wrapper can help avoid he display of errors.
If you want to put all of the values into a single cell, then a User defined Function (aka UDF) could concatenate the array into a single string. This last method is generally not recommended as it renders the values useless for anything other than display purposes.
Array formulas need to be finalized with Ctrl+Shift+Enter↵. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula.
Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum.
See Guidelines and examples of array formulas for more information.