Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Good evening everyone,
I have 43 level and in each level I have 16 elements ... I want mathcad to calculate the average value in each level >> summing the 16 elements in each level and dividing them by their number (16).
but what I get is the opposite ... it sums all the levels (43) and divides them by 43...
I expect the answer to contains 43 value not 16
I tried to use programing ..I get worse result
I also, tried to use a simple mathcad sheet to post .. it works there , but not at my original sheet ;(
I posted both the original and the simplified version for your assessment
Thanks in advance
Solved! Go to Solution.
I think this does what you want for the average.
However, I'm wondering whether your calculated value Rc;cal;C;CPT;min is what you want, as that only has 16 values (ie, is the minimum of the 43 layers for each of the 16 "element" vectors)?
Stuart
I tried also this >>
so to clarify more ... The R is a nested which are the results of 16 elements (CPT)
the number 43 represents the level of each R
I want to calculate the average value of R in each level .... the function has to calculate average of the Rs of the 16 elements in each level
So the answer should be 43 vector
I think this does what you want for the average.
However, I'm wondering whether your calculated value Rc;cal;C;CPT;min is what you want, as that only has 16 values (ie, is the minimum of the 43 layers for each of the 16 "element" vectors)?
Stuart
Stuart>> Thank you so much that works for me
It is been a while since we last chatted...I hope you are doing well
@YA_10963798 wrote:
Stuart>> Thank you so much that works for me
It is been a while since we last chatted...I hope you are doing well
It has indeed been a while, Yusra. I hope you are likewise doing well - and finding time to do other things on your weekend besides work! Still, who am I to talk ... 🙂
Stuart
for the minimum value I tried to use same concept ...it says it must be a vector
@YA_10963798 wrote:
for the minimum value I tried to use same concept ...it says it must be a vector
Yes. That, unfortunately, is to be expected because the statistical functions do not vectorize.
So, a different approach is needed. Fortunately, it is a simple one.
Stuart
(I've redefined rows and cols at the beginning of your worksheet to avoid conflicts with the built-in functions of the same name. I've also disabled the CWD definition because I don't have that folder, and I'm far too lazy to scroll back to the top of the worksheet to re-enable it.)
Thank you so much Stuart that so thoroughly explained and solved
I appreciate your help
It looks to me that @YA_10963798 is maybe(?) rather looking for something like this:
Not sure if the result should be a nested vector as shown in the picture above or rather a simple 12x1 vector.
But in any case I would prefer a functional solution like @StuartBruff had provided which is more generic and does not need to define any worksheet range variables.
Guess that Stuart has already solved your problem. Next time you create a simplified sheet it would be a good idea to manually type in the complete result vector you would like to create. That way it would be much clearer what you are looking for and also it would be clear which data structure you would like to see the results to be arranged in (nested vector vs. simple vector).
BTW, I couldn't make a try with your original sheet because of the missing Excel data file (I finally cleaned up my workspace). I know you posted it in other threads earlier, but I was far too lazy to look around for it.
Like Stuart I fond it irritating that you defined "rows" and "cols" as variables. We often need to use the built-in functions of the same names when working in your sheet and its tedious to experience an error message every time we do because Prime assumes that we mean your variable and we have to manually re-label the name as being a "function" and not a "variable".
I strongly second Stuarts suggestion that you should rename those variables as he already has shown in the sheet he posted.
Curses! Foiled again!
I was about to reply to Tetsuro's post, but I see you've beaten me to it.
Still, here's a range variable version ...
And an implied version of TransposeNested that uses a matrix intermediary to do the transposition.
It's often a lot easier to work on a matrix than nested vectors. And vice versa. 😇
Stuart
Hi Werner,
I hope you are doing well... Thank you for your reply .
I attached both sheets because I felt it is maybe needed ...
For the rows and cols ,,, To be Honset , Stuart has told me before and I fixed it in another sheet and haven't done it here as well.. I will fix that right away