From: CELC da Cunha on 20 Jul 2010 12:10 Hello all, I am pretty new to MatLab so i am pretty sure this must be an easy question - but i couldn't find it on the forum or on google. I wrote a code that generates a graph for each given column of my matrix, each time i press '->' it moves to the next column. But now i want to add some extra functionality to it - i want to whenever i press the space bar (or anything in my keyboard) to have the original column copied into another matrix. This way i would generate a 'selected matrix' out of a 'raw matrix'. I guess the code should be something like this: if spacebar.activate=true then column.copy newmatrix.column.paste else next I just don't know how to put it into MatLab language. Thanks :)
From: Sunny on 20 Jul 2010 13:43 Play around with the 'input' function. It prompts the user for a keyboard input, and depending on what key you choose, you can make a loop out of it. i.e. reply = input('Do you want more? Y/N [Y]: ', 's'); if isempty(reply) reply = 'Y'; end Cheers "CELC da Cunha" <cadu.cunha(a)gmail.com> wrote in message <i24hpe$kgd$1(a)fred.mathworks.com>... > Hello all, > > I am pretty new to MatLab so i am pretty sure this must be an easy question - but i couldn't find it on the forum or on google. > > I wrote a code that generates a graph for each given column of my matrix, each time i press '->' it moves to the next column. But now i want to add some extra functionality to it - i want to whenever i press the space bar (or anything in my keyboard) to have the original column copied into another matrix. > > This way i would generate a 'selected matrix' out of a 'raw matrix'. > > I guess the code should be something like this: > > if spacebar.activate=true then column.copy > newmatrix.column.paste > else next > > I just don't know how to put it into MatLab language. > > Thanks :)
From: CELC da Cunha on 20 Jul 2010 13:55 I will most certainly have a look at it closely - but i guess this input function only answers one part of my problems, am i correct? I mean, if i got it correct, it prompts in case a given a thing is pressed - i want no prompt, but an action. And that is not what i saw on the help file of this function :(
From: someone on 20 Jul 2010 13:57 "CELC da Cunha" <cadu.cunha(a)gmail.com> wrote in message <i24hpe$kgd$1(a)fred.mathworks.com>... > Hello all, > > I am pretty new to MatLab so i am pretty sure this must be an easy question - but i couldn't find it on the forum or on google. > > I wrote a code that generates a graph for each given column of my matrix, each time i press '->' it moves to the next column. But now i want to add some extra functionality to it - i want to whenever i press the space bar (or anything in my keyboard) to have the original column copied into another matrix. > > This way i would generate a 'selected matrix' out of a 'raw matrix'. > > I guess the code should be something like this: > > if spacebar.activate=true then column.copy > newmatrix.column.paste > else next > > I just don't know how to put it into MatLab language. > > Thanks :) If you generated a graph and want a GUI solution, look at the figure's KeyPressFcn property.
|
Pages: 1 Prev: How to output to file the output of classregtree Next: multiple paths for same file |