From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-14-2021 03:51 AM
I have a 4x5 matrix
I want to take out each col (4x1) and convert that into (2x2) now I want to get the max elements array till now
confused in RED BOX
Solved! Go to Solution.
01-14-2021 04:47 AM
You would probably get better help if you put more time into asking your questions more clearly and *thoroughly*.
I for one usually avoid threads where questions are unclear or ambiguous because they often lead to a big waste of time. It's frustrating to spend time on explanations and answers, only to find that they're either ignored or irrelevant because the original poster didn't take the time to be more clear or provide important context.
Help us out. Help us help you. Describe what you're doing and why. Give some example data as input and show us what you want as output. And again, explain the purpose. Many posters here get stuck part way along the wrong path and wind up asking a too-narrowly-focused "wrong question". Often the best solution isn't to help them move farther down the wrong path. Rather, it's to identify a different better path altogether.
-Kevin P
P.S. The first most obvious "red box" problem is that none of your matrix data or operations are inside the loop.
01-14-2021 05:03 AM - edited 01-14-2021 05:08 AM
If it's just the red box you're confused about (as am I as I look at it, what are you doing?), the loop should encompass both your array manipulations. Then you remove the Index array, as if it's Autoindexed you'll get 1 row at a time inside the loop.
01-14-2021 05:45 AM - edited 01-14-2021 06:30 AM
Thank You, I will try to improve the writing of the post further.
this is my main intention I have shown this without for loop and only for 0th index and 1st index, I want to do it till 4th index
This is I tried but was not able to get an updated max matrix RED BOX
01-14-2021 06:26 AM
If you want to convert a 4x5 array into 5 2x2 arrays and then take the maximum value by index of those 5 arrays...
Then I would take the maximum value of each column in the 4x5 array and then reshape the 4 resulting values into a 2x2 array:
01-14-2021 06:38 AM
I just gave kudos to RamonG for posting the exact same code I was about to post (so of course I like it), only quicker. The transpose allows for auto-indexing, and there's no need to reshape until after the loop.
-Kevin P