T O P I C R E V I E W |
MichelDe |
Posted - 07/06/2023 : 05:57:12 AM Origin Ver. and Service Release (Select Help-->About Origin): Operating System: 9.8.5.201 , Win10
Hello! I have a "simple" index problem and hope that someone can help.
I have a column A with data points and I want to calculate the mean value of certain points (not all) between the rows x and y.
The index for x and y should be easy to change - thus I want to put x and y in column B and C as the first value.
To calculate the mean value of the values in column A between row x and row y I used the following formula:
mean(A[B1:C1])
But in this way I only the mean value of the two values at position x and y. The values in between were not taken.
So basically I need the right syntax to get out all values between index x and y without putting x and y directly into the formula. This is important as the same indices should be used for multiple different calculations.
Thanks! |
5 L A T E S T R E P L I E S (Newest First) |
ChaoC |
Posted - 07/06/2023 : 4:35:41 PM Hello,
It looks like this was fixed in 2022b: https://originlab.jira.com/wiki/spaces/main/pages/2485846067/Origin+2022b+Bug+Fixes#:~:text=in%20Orign%202022b.-,ORG%2D24699,-SCV%20named%20range
If you can't upgrade, then as a workaround, you can do this:

You can hide column D if you want a cleaner worksheet.
Best, Chao |
MichelDe |
Posted - 07/06/2023 : 10:39:51 AM Okay thanks!
One more question came up... When I chance of the indices or even values in the respective column (A), the calculated values are not updated. Everything is set to "recalculate automatically" but nothing happens
The only way it is recalculating with new values is when I type in the formula again. Is there a solution for this? So that all calculations are recalculated every time when I change the indices? |
ChaoC |
Posted - 07/06/2023 : 10:15:49 AM Hello,
The -v option is not strictly necessary in this case and you can read about it here: https://www.originlab.com/doc/en/LabTalk/guide/Range-Notation#Option_Switch_-vOption_Switches
The ; is how you end a line in a LabTalk script.
If you upgrade to at least Origin 2022, you would also have the option of using Named ranges: https://www.originlab.com/doc/en/Origin-Help/Named-Range
E.g.

Best, Chao |
MichelDe |
Posted - 07/06/2023 : 10:04:22 AM Hello Chao,
thanks! that worked.
Just to understand that "code" what does "-v" mean? And why are the ";" necessary?
Best, Michel |
ChaoC |
Posted - 07/06/2023 : 09:53:38 AM Hello,
You can use LabTalk to set the data range.

Best, Chao |