octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60153] Produces no resulat when using an arra


From: anonymous
Subject: [Octave-bug-tracker] [bug #60153] Produces no resulat when using an array
Date: Mon, 1 Mar 2021 10:07:56 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0

URL:
  <https://savannah.gnu.org/bugs/?60153>

                 Summary: Produces no resulat when using an array
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 01 Mar 2021 03:07:54 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Heinz-Georg Fehn
        Originator Email: fehn@fh-muenster.de
             Open/Closed: Open
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Using   h_b(ii)=uicontrol(... in a loop

and get(h_b,'value') in the callback function will not given a result which
button was hit.

In Matlab the hselected cellarray of h_b(ii) will be marked with 1, the others
are zero.

See added code. 

Main

%---------------------
function ui_test

global h_b

clc;
close all
scrsz = get(0,'ScreenSize');
src_y=scrsz(4);
blatt=900;
src_p=src_y-blatt-50;
wide=1100;
pos=blatt-10;
dum=ver;
b=dum.Name;
if strcmpi(b,'octave')
    figure(1,'Units','pixels','Position',[20 src_p wide
blatt],'MenuBar','none','Color',[0.8 0.8 0.8],...
    'Name','UI_test','resize','off')
else
    figure(1)
    set(1,'Units','pixels','Position',[20 src_p wide
blatt],'MenuBar','none','Color',[0.8 0.8 0.8],...
    'Name','UI_test','resize','off')
end

for ii=1:4 
    h_b(ii)=uicontrol('Style','pushbutton','Position',[10 pos-ii*30 30
30],'string'...
        ,num2str(ii),'FontSize',10,'Callback','test');
end 
%--------------------

Callback function for test

function test()
global h_b

get(h_b,'value')


will show:
>> ans =
{
  [1,1] = 0
  [2,1] = 0
  [3,1] = 0
  [4,1] = 0
}


whereas the same call in Matlab will show

ans =

  4×1 cell array

    {[0]}
    {[0]}
    {[1]}
    {[0]}

if 3rd button was selected
Best regards

Heinz-Georg Fehn






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60153>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]