[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: building portable gui working under octave and matlab in all support
From: |
Alex Vong |
Subject: |
Re: building portable gui working under octave and matlab in all supported OSs |
Date: |
Tue, 26 Apr 2016 02:55:11 +0800 |
Hi,
Thanks for the suggestion. However, I am having some problem with the
provided example, in the ui elements does not show up on the window,
only an empty window is shown up. I will provide more details later
when I resume working on it.
Besides, I want to report something that looks like a bug. Consider
the following commands:
dot([1 i], [i 2])
==> ans = 0 - 1i
dot(sym([1 i]), sym([i 2]))
==> ans = (sym) 3⋅ⅈ
which seems to be inconsistent.
The numeric dot function seems to be computing complex inner product,
which is conjugate linear in the first slot, while the symbolic dot
function seems to be computing real inner product, which is bilinear.
Also, pararrayfun, parcellfun in parallel package does not play nice
with functions returning symbols. In particular,
arr = arrayfun(@sqrt, [sym('a') sym('b')])
==> arr = (sym) [√a √b] (1×2 matrix)
a = pararrayfun(4, @sqrt, [sym('a') sym('b')])
==> parcellfun: 2/2 jobs done
error: cell2mat: wrong type elements or mixed cells, structs,
and matrices
error: called from
cell2mat at line 54 column 11
parcellfun at line 442 column 23
pararrayfun at line 80 column 26
The ordinary arrayfun works but not its "par" cousin, same goes for cellfun.
Thanks,
Alex
On 20/04/2016, Mike Miller <address@hidden> wrote:
> On Tue, Apr 19, 2016 at 07:16:06 +0000, Alex Vong wrote:
>> Hi,
>>
>> I am a student taking a required course in matlab. I am given an
>> assignment to build a gui in it. According to my teacher, the only
>> requirement is that it is all written in m-files. Is it possible to
>> build a gui in octave such that it works in matlab as well? I
>> personally use gnu/linux, my school use windows, some of my tutors
>> uses os x, so it has to work in all three OSs. Currently, I use the
>> trick which generate a perl script at runtime, saving in to temporary
>> directory and execute it. The perl script uses Tk to build the gui.
>> Does anyone know of a better method?
>
> That sounds like it's not written in m-files at all.
>
> I think the portable Octave / Matlab way to create a GUI would be using
> the uimenu, uicontrol, etc, functions.
>
> See https://www.gnu.org/software/octave/doc/interpreter/UI-Elements.html
> for all of the available functions.
>
> A small motivating example (using Octave syntax):
>
> win = figure ("menubar", "none", "position", [0 0 640 480]);
> file_menu = uimenu (win, "label", "File");
> help_menu = uimenu (win, "label", "Help");
> exit_action = uimenu (file_menu, "label", "Exit", ...
> "callback", @() close (win));
> canvas = uipanel ();
> button = uicontrol ("style", "pushbutton", "string", "Push Me", ...
> "position", [0 460 100 20], ...
> "callback", @() disp ("pushed"));
>
> --
> mike
>