EDUCBA

EDUCBA

MENUMENU
  • Explore
    • Lifetime Membership
    • All in One Bundles
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign up
Home Data Science Data Science Tutorials Matlab Tutorial Permute Matlab

Permute Matlab

Priya Pedamkar
Article byPriya Pedamkar

Updated March 4, 2023

Permute Matlab

Introduction to Permute Matlab

‘Permute’ command in Permute Matlab is used to rearrange the elements within a multidimensional array. To access this command we just need to pass the order of the multi-dimensional matrix. It has various features like dimension, size, circshift, and reshape. Permute command can be implemented for a reverse condition which is specified by ‘ipermute’. permute and permute are two conditions of the transpose. The output of permuting is always transposed of the output of permute and output of permuting is always transposed of the output of ipermute.

ADVERTISEMENT
Popular Course in this category
MATLAB Course Bundle - 5 Courses in 1 | 3 Mock Tests

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax

Below is the syntax for Permute Matlab:

Output = permute( input, [ 2 1 ] )
Output variable name = permute ( input variable name, order of dimension )
Output = ipermute ( input, [ 1 2 3 ] )
Output variable name = ipermute ( input variable name, order of dimension )

Why we use Permute Matlab?

The main principle of permuting is to rearrange the elements of multi-dimensional matrix .so while solving matrix or multidimensional problems but if we face size overfitting or underfitting issues then we can use permute and ipermute commands. It reduces the complexity of the system and helps to understand the problem in a better way.

Examples to Implement Permute Matlab

Below are the examples mentioned :

Example #1

Let us assume one matrix input with two rows and two columns. Row 1 elements are 1 and 2 and row 2 elements are 3 and 4. And let us give the order as 2 and 1.

Code:

clc ;
clear all ;
input = [ 1 2 ; 3 4 ] output = permute ( input, [ 2 1 ] )

Output:

matrix input with two rows

Example #2

In this example, we randomly created an input matrix with three rows and two columns and there are three such matrices. Along with the input we have pass order as [ 3 2 1]. Implementation of example 2 (a) shows permute command and example 2 (b) shows ipermute command. If we observe both the outputs then the output of example 2(b) is the transpose of the output of Example 2 (a) and vice versa.

a. permute command

Code:

clc ;
clear all ;
rng default
input = rand ( 3 , 2 , 3 )
output = permute ( input, [ 3  2 1 ] )

Output:

Permute matlab2

Permute matlab3

b. ipermute command:

Code:

clc ;
clear all ;
rng default
input = rand(3,2,3)
output1 = ipermute ( input , [ 3 2 1 ] )

Output:

Permute matlab4

Permute matlab5

Example #3

In this example, we will use one feature of the permuted matrix that is size. Here we consider one random input of parameters ( 9, 1 0, 1 1) which represents a total eleven matrix,  nine rows, and 10 columns. here we have changes order three times to check the size of the output matrix. Assume three orders as [ 3 2 1 ]  , [ 2 1 3 ] and [ 1 2 3 ]. If we observe the output of three matrix and sizes of three matrices then all the dimensions are different.

Code:

clc ;
clear all ;
rng default
input = rand ( 9, 10, 11) ;
output = permute ( input, [ 3  2 1 ] ) ;
output1 = permute ( input , [ 2 1 3 ] ) ;
output2 = permute ( input, [ 1 2 3 ] ) ;
size ( output)
size ( output1)
size ( output2)

Output:

total eleven matrix

Conclusion

In this article, we have seen how to use permute and ipermute command and how to arrange elements in matrix or multidimensional array or vector. By using permute command we can handle large data and n number of elements.

Recommended Articles

This is a guide to Permute Matlab. Here we discuss an introduction to Permute Matlab, syntax, and implementation with programming examples. You can also go through our other related articles to learn more –

  1. Matlab traps()
  2. Matlab Sine Wave
  3. Ceil Matlab
  4. Matlab Plot Colors
  5. MATLAB cylinder()
ADVERTISEMENT
SPSS Course Bundle - 14 Courses in 1 | 5 Mock Tests
34+ Hours of HD Videos
14 Courses
5 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
MICROSOFT AZURE Course Bundle - 15 Courses in 1 | 12 Mock Tests
63+ Hour of HD Videos
15 Courses
12 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
HADOOP Course Bundle - 32 Courses in 1 | 4 Mock Tests
125+ Hour of HD Videos
32 Courses
4 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
ADVERTISEMENT
INFORMATICA Course Bundle - 7 Courses in 1
47+ Hours of HD Videos
7 Courses
Verifiable Certificate of Completion
Lifetime Access
4.5
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
  • Blog as Guest
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

🚀 Cyber Monday Reloaded Price Drop! All in One Universal Bundle (3700+ Courses) @ 🎁 90% OFF - Ends in ENROLL NOW