[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Experimental matrix editor patch
From: |
Daniel J Sebald |
Subject: |
Re: Experimental matrix editor patch |
Date: |
Sat, 04 May 2013 23:51:47 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 05/01/2013 01:47 PM, John W. Eaton wrote:
I've uploaded a patch to implement an experimental spreadsheet-like
matrix editor for the GUI here:
https://savannah.gnu.org/patch/index.php?8039
This is a very bare-bones proof-of-concept implementation.
To use it, apply the patch to the development branch, rebuild Octave,
then right click a variable name in the workspace viewer and select
"Open in Variable Editor" from the context menu.
It's a start. I like the slide bars for quickly moving around within
large matrices.
I get a segfault when I click "Done", so I can't tell what happens after
that. I suggest it should place a command in history "x(2,3) = 6", for
example. That is, anything that modifies workspace memory should show
up in the history somehow.
[comments below]
There are many things left to do, and many decisions to be made about
what exactly we would want from something like this. For example,
* it currently only handles double precision values (should we be
able to edit arbitrary Octave data structures, or just numeric
data?)
* it doesn't preserve full precision (moving data in and out is done
by converting to/from text)
* resizing the matrix isn't possible
* inserting rows or columns isn't possible
* applying functions or performing arithmetic on the data (or
regions) is not possible
* editing is possible, but normal spreadsheet operations like filling
a region is not possible
Might not be hard. If the cell begin:end of a selected area is known,
can issue command like "x(3:5,7:10) = 0".
* you are not prevented from inserting non-numeric data
There might be a way to configure that in the table view, but more than
that I wonder if the "Done" button is actually needed. Instead, when
someone edits a cell and hits return, then a command like "x(2,3) = 6"
should be sent to Octave core. If the user types "foo", so that "x(2,3)
= foo" is sent and comes back as an error, then the contents of the cell
should be reverted back to the original number.
* things like "Inf" and "NaN" aren't recognized
Probably not a difficult addition.
* only 2D arrays are handled properly
* only one variable may be edited at a time (I guess we could use a
tabbed editor, or some other way of managing multiple matrix edit
windows)
I think that is enough for a start. Multiple tabs might be OK, just
like multiple tabs for files, but don't get too complicated from the
start. I do think the "Done" button should be removed. That way there
isn't some sort of "unsaved" matrix modification hanging about. It is a
workspace variable, not a file. It would get too confusing to have too
many variables being edited and "unsaved". Now, there would probably
eventually be a request to allow saving/loading matrices from the
variable editor to/from files, but I'd say leave that for down the road.
Again, whatever is shown in that variable editor should exactly match
what is in workspace memory.
* we don't keep track of the original scope of the variable, so if
you start editing a variable, then use the debugger and step into a
function, then click "done" in the matrix editor, the variable will
be inserted into the current scope, which is the one the debugger
is visiting
Get rid of "Done", save the scope.
* and many other things, I'm sure...
What I think would be a nice feature is to have a background color for
the cells based upon their value. I'm thinking, say sparse matrices
where the matrix might be big but mostly zero. (Or maybe even better a
little slider for a cut level that will color the background of elements
above a certain value and not color the background of elements below
that value.) If the non-zero entries have a background color tint, that
might make viewing the matrix easier. Could be useful for eigen
structure, who knows?
Dan