# MATLAB-STRUCTURES

How can I sort the rows of a structure based on 3 of its columns?
Asked:
###### Who is Participating?

Commented:
Per recommendation, points NOT refunded and question closed.

Netminder
EE Admin
0

Commented:
kaushal:

can you please give feedback for earlier posts?
0

Author Commented:
Thank you for the earlier answers .Do you know how to sort structures?
0

Commented:
If you are happy with earlier answers, can you please close those questions?
Sorting structures.... we can help you for sure. Can you please elaborate on this
because your question is not clear to me. (i.e. what you meant by "based on 3 of its columns"?)
0

Author Commented:
I will close them.

This is a sample of the structure:

Fieldname1 Fieldname2 Fieldname3 Fieldname4      Fieldname5
num1a        num2a      strnum3a2    strnum4a3      num5a
num1b        num2b      strnum3b1    strnum4b3      num5a
num1c        num2c      strnum3c2    strnum4c2      num5a

*num stands for just a number
*strnum stands for (abc_ghi_123.jkl)

i need to sort this structure by the num in strnum(2 columns) and num in another column.(ie)under fieldname3,the values should be rearranged as:

strnum3a1
strnum3a2
strnum3a2.
this should affect the rearranging of corresponding rows in other columns.then when sorting by the num in fieldname4 it should look like this :

strnum3a1  strnum4a3
strnum3a2  strnum4a2
strnum3a2  strnum4a3

finally another sort is done by fieldname1 which is a number.

please reply if you need more clarification.

my e-mail address is suetibu@hotmail.com

i appreciate all the responses.
0

Commented:
Sorting array of structures is not difficult. In any sorting, two things are important.
(1) KEY
(2) SWAPPING VALUES

I hope you are familiar with 'C'. See these two references:

Arrays of Structures

http://www-ee.eng.hawaii.edu/~tep/EE150/book/chap12/section2.1.2.html

Sorting Arrays of Structures
http://www-ee.eng.hawaii.edu/~tep/EE150/book/chap12/section2.1.3.html

I'm sure you will be able to do this. If you could not, please post whatever you did and we'll help to fix the problems(if any).
0

Commented:
Kaushal:
Any update?
0

Commented:

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Already a member? Login.

All Courses

From novice to tech pro — start learning today.