Working with filters on vectors
Hi all, I am putting together a calculation sheet where the input data is entered using the Excel component. The first column is the thickness of my layers, called h. In the "Outputs" section of the Excel component, I define h as having a range between cell A2 and A21 (so maximum number of layers is 20). However, if the user enters less than 20 layers, I wanted to give the option to not have to change the range definition so I was using a filter function to remove all non-defined values of h as follows:
h := filterNaN(markNaN(h,match(0,h)))
This works great; for example, if I define 9 layers, I get a vector length of 9, even though up to 20 layers can be entered.
However, one of the other input variables, called OCR, applies to some layers and doesn't apply to others. For the layers that it doesn't apply to, I enter "NaN" in the cell to show that it is not applicable as below:
| h (m) | OCR |
| 0.5 | 2 |
| 0.5 | 2 |
| 0.5 | 2 |
| 0.5 | 2 |
| 0.5 | NaN |
| 0.5 | NaN |
| 0.5 | NaN |
| 0.5 | NaN |
| 0.5 | NaN |
However, if I use a similar filter function, replacing the "0" with "NaN", of course it cuts of the length of the OCR vector to 4. I tried writing a for loop instead but some reason that is still giving me a vector length of 20.
Any thoughts? Thanks in advance!

