Creating a new Matrix by Sorting Through a Different Matrix

Creating a new Matrix by Sorting Through a Different Matrix - Messages

#1 Posted: 9/28/2014 4:41:44 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

I'm trying to program a loop which runs through a vector matrix and throws out values which I don't want and puts values I do want into a new matrix.

Lets give 2 situations:

The first -> I want to check a column matrix which has a number of heights say, 10ft, 20ft, 30ft, 50ft. I want to set a certain height, say 25ft. The loop should check each height if it is greater than 25ft. If it is greater than 25ft than disregard the value. However the last value of the new matrix should be 25ft. So in the end it would be 10ft, 20ft, 25ft

Second -> You have a column matrix of random values. You only want values between X and X', the rest may be discarded.


Thanks in advance for any suggestions!!
#2 Posted: 9/28/2014 4:47:53 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

I think I solved situation 1 using "Break" (which I forgot I could use in SMath) but it does throw an error message see below:

For Loop Break
#3 Posted: 10/3/2014 10:14:14 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

Thanks again Ioan!

So for the first problem -> use of a counter and the continue argument, very nice.

For number 2:

First sort the information which is subject to the demands.
Next find the rows minimum and maximum rows and keep these to resize the matrix. kkk=0 is basically a do nothing command.
Then we define a submatrix which only has the data between the demands and in this case returns the entire row of the matrix.

Very good, Thank you!!

  • New Posts New Posts
  • No New Posts No New Posts