Jump to content



Photo
- - - - -

Help On Shifting Matrix Rows/columns


  • Please log in to reply
9 replies to this topic

#1 dschlic1

dschlic1

    Newbie

  • Members
  • Pip
  • 4 posts

  • Calculators:
    CFX-9850+

Posted 19 June 2008 - 05:17 PM

I have a Casio CFX-9850+ which I am writing a program to perform swimming pool chemical calculations. One of the operations I want the program to perform is to store the last thirty water analysis test results. I will then use this stored data to create graphs or trends of the analysis results.

I am currently using a matrix to store the test results. Each time a new set of test results is entered, I need to shift all of the existing data over one place. Right now I am useing two For...Next loops to shift the data. However this is rather slow. I have not been able to find any built in command to perform a similiar operation. Does anyone here have any suggestions?

#2 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 20 June 2008 - 03:28 AM

Hello dschlic1 and welcome to the UCF!

I don't know how to move the data over one column in a matrix, however, if you stored your data into lists, it's very easy to move them such as List1 [->] List 2.

#3 R00KIE

R00KIE

    Casio Freak

  • Members
  • PipPipPipPip
  • 155 posts
  • Location:Portugal
  • Interests:Electronics, games, programming

  • Calculators:
    HP49G ROM 1.24; CASIO CFX-9850GB PLUS;CASIO FX-6300G; CASIO FX-82TL

Posted 25 July 2008 - 03:02 PM

This comes a bit late but you could try to augment your matrix, check the manual how to do it (i don't remember how to do it now, sorry).
Also don't forget to check all the transform tools available (augment, transpose and so on).

#4 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 25 July 2008 - 05:42 PM

I'd still think using lists would be better, because then you can directly plot the data on a graph with the calculator.

#5 Somelauw

Somelauw

    Newbie

  • Members
  • Pip
  • 14 posts

  • Calculators:
    Casio CFX-9850GC PLUS

Posted 09 September 2008 - 01:12 PM

When I made a snake game, I also needed a way to quickly shift the data. (the snake is moving)
I came up with the idea to use the list as a circular queue.

You could probably use a circular matrix.

Here is a link with explanation. (Seems like I wasn't the first one who came up with this idea)
http://en.wikipedia....Circular_buffer

#6 dschlic1

dschlic1

    Newbie

  • Members
  • Pip
  • 4 posts

  • Calculators:
    CFX-9850+

Posted 16 September 2008 - 03:10 PM

I had thought about augment for adding to the matrix. But that just adds to the matrix. I have not found any way via the program to delete a row or column of a matrix. Some more information: the matrix is 10 by 30. There are ten possible test results that can be stored. I also thought of lists, but because a file can only hold six lists, I would have to use two files complicating programming.

I am interested in graphing the test results, however I have not found any automatic method of graphing either list or matrix data. Is there a way to graph a list? The built in list to graph just uses the list as a series of coefficients for the x variable.

#7 Somelauw

Somelauw

    Newbie

  • Members
  • Pip
  • 14 posts

  • Calculators:
    Casio CFX-9850GC PLUS

Posted 17 September 2008 - 01:27 PM

I had thought about augment for adding to the matrix. But that just adds to the matrix. I have not found any way via the program to delete a row or column of a matrix. Some more information: the matrix is 10 by 30. There are ten possible test results that can be stored. I also thought of lists, but because a file can only hold six lists, I would have to use two files complicating programming.

What do you mean by deleting a row or column?
You cannot resize a matrix without deleting it if that's what you mean>

I am interested in graphing the test results, however I have not found any automatic method of graphing either list or matrix data. Is there a way to graph a list? The built in list to graph just uses the list as a series of coefficients for the x variable.

Read the manual. If there is no built0in way, then just use a for loop. Use lines to connect the points.

#8 BαBœk

BαBœk

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    fx-3600Pv
    fx-9860G

Posted 16 April 2009 - 05:29 PM

hi 

I am looking around posts that i have not seen yet, and i see this problem

2008... but...

we could do this with little code i have do this in my fx9860g.

1- traspose mat A  // change row with column

2- swap rows one by one

3- traspose it agane

Example code:

[codebox]

Dim Mat A       // put  Mat A Dimentions in List Ans

List Ans2->N     // Put number of columens in N

Trn Mat A->Mat A     // change columns with rows

For 1->C To (N-1)

Swap Mat A,C,C+1  

Next

Trn Mat A-> Mat A



[/codebox]

Note:

1- this code shifts column 1 to 2, 2 to 3, 3 to 4,... at the end the first column has been moved to end column so you can put new valus to end column

2- look at transpose operation!!! if you dont put the result in mat A the result go in Ans mat and the swap operation dont return right mat.(it swaps the rows ensted at the end) ( this was my problem too)

Edited by Babak, 16 April 2009 - 05:30 PM.


#9 Guest_gsh_*

Guest_gsh_*
  • Guests

Posted 22 April 2009 - 12:14 PM

I don't know if dschlic1 is around anymore, but your idea is brilliant BαBœk. Much faster than copying each entry individually.

One small correction: the Swap line should be
Swap A,C,C+1

#10 BαBœk

BαBœk

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    fx-3600Pv
    fx-9860G

Posted 22 April 2009 - 01:46 PM

Thank you :rolleyes:

you are right!!!

I love Matrises, and solving my problems with them!! they are very powerfull beings!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users