32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
Maybe the question is a little bit confused, I'll make an example below.

Let's say I have a 3 matrices a, b, c with same size. [code] a = [2, 5; 6, 9]; b = [3, 3; 8, 1]; c = [5, 5; 2, 7];[/code] How can I get the new matrix max with each max element in all three matrices?
[code]max = [5, 5; 8, 9][/code] I know I could create logical matrix like a>b and then do the math, calc it out, is there any other more efficient way to do it?
TEP , The Engineering Projects , Icon Answer: 2 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
That's not much difficult, use the below code: [code]maxMatrix = [max(a) max(b) max(c)];[/code] maxMatrix will be your matrix with maximum values of matrix a, b and c. Moreover, it will be a vector and if you want a 2 Dimensional matrix then add d too.
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
[quote=theenggprojects post_id=553 time=1489047921 user_id=2] That's not much difficult, use the below code: [code]maxMatrix = [max(a) max(b) max(c)];[/code] maxMatrix will be your matrix with maximum values of matrix a, b and c. Moreover, it will be a vector and if you want a 2 Dimensional matrix then add d too. [/quote] Thanks for the code :)
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.