dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: [RESOLVED] Matlab

  1. #1
    Join Date
    Nov 2017
    Posts
    7

    [RESOLVED] Matlab

    Name:  Matlabpic.jpg
Views: 75
Size:  16.8 KB
    I have a Gui with a table in it.
    When a press a button it should fill the able with the results from an array in the workspace!


    BatteryDischargeCalc = assign(handles.uitable5,'data')


    % set(handles.uitable10, 'Data', BatteryDischargeCalc);

    These are the commands I have tried and have had no luck?
    Any ideas?
    Attached Images Attached Images  
    Last edited by KORKIS2; March 8th, 2018 at 04:04 PM.

  2. #2
    Join Date
    Nov 2017
    Posts
    7

    Re: Matlab

    Name:  Matlabpic.jpg
Views: 60
Size:  16.8 KB

    I somehow uploaded the wrong picture this is the table I was talking about!

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,223

    Re: Matlab

    Quote Originally Posted by KORKIS2 View Post
    ...
    I somehow uploaded the wrong picture this is the table I was talking about!
    And where is the button you press?
    How does the message handler for this button (button-click) look like? Could you show your exact code?
    Did you debug your code?
    Victor Nijegorodov

  4. #4
    Join Date
    Nov 2017
    Posts
    7

    Re: Matlab

    This is a GUI. It is just a simple toggle button however I have a couple hundred lines of code.
    Is the code wrong any other suggestions. I think the data might be in the wrong format in the array. When pulling from a workplace string.
    I have screen share that might be easier to communicate and share the code?
    Thanks let me know sir

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,223

    Re: Matlab

    Quote Originally Posted by KORKIS2 View Post
    This is a GUI.
    Yes, it is clear enough.

    Quote Originally Posted by KORKIS2 View Post
    It is just a simple toggle button however I have a couple hundred lines of code.
    Is the code wrong any other suggestions.
    If your code does not work as expected then yes, it is wrong.

    Quote Originally Posted by KORKIS2 View Post
    I think the data might be in the wrong format in the array. When pulling from a workplace string.
    ...
    Yes, it "might be in the wrong format in the array". But how could we know it?
    Victor Nijegorodov

  6. #6
    Join Date
    Nov 2017
    Posts
    7

    Re: Matlab

    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject handle to pushbutton4 (see GCBO)
    % eventdata reserved - to be defined in a future version of MATLAB
    % handles structure with handles and user data (see GUIDATA)
    set(handles.uitable5, 'Data', BatteryDischargeCalc)

    The table is table 5 and I am trying to put the data from the array BatterydischargeCalc of 101X63 into it by using push button 4


    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject handle to pushbutton4 (see GCBO)
    % eventdata reserved - to be defined in a future version of MATLAB
    % handles structure with handles and user data (see GUIDATA)
    BatteryDischargeCalc = assign(handles.uitable5,'data')

    This the second thing I tried ...

    And below is the error I am getting
    Error in
    matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)SimpleOptimizedTabs2('pushbutton4_Callback',hObject,eventdata,guidata(hObject))
    Error while evaluating UIControl Callback.


    I appreciate your time and help I am new to posting on forums thank you

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,223

    Re: Matlab

    Please, read the Announcements to learn how to post/attach the code to your post in this Forum.
    Victor Nijegorodov

  8. #8
    Join Date
    Nov 2017
    Posts
    7

    Re: Matlab

    Code:
    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject handle to pushbutton4 (see GCBO)
    % eventdata reserved - to be defined in a future version of MATLAB
    % handles structure with handles and user data (see GUIDATA)
    set(handles.uitable5, 'Data', BatteryDischargeCalc)
    The table is table 5 and I am trying to put the data from the array BatterydischargeCalc of 101X63 into it by using push button 4

    Code:
    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject handle to pushbutton4 (see GCBO)
    % eventdata reserved - to be defined in a future version of MATLAB
    % handles structure with handles and user data (see GUIDATA)
    BatteryDischargeCalc = assign(handles.uitable5,'data')
    This the second thing I tried ...

    And below is the error I am getting
    Error in
    matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)SimpleOptimizedTabs2('pushbutton4_Callback',hObject,eventdata,guidata(hObject))
    Error while evaluating UIControl Callback.


    I appreciate your time and help I am new to posting on forums thank you

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,223

    Re: Matlab

    Quote Originally Posted by KORKIS2 View Post
    ...
    Error in
    matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)SimpleOptimizedTabs2('pushbutton4_Callback',hObject,eventdata,guidata(hObject))
    Error while evaluating UIControl Callback.
    Did you try to google for this error message? Something like:
    https://www.google.de/search?q=matla...hrome&ie=UTF-8
    Victor Nijegorodov

  10. #10
    Join Date
    Nov 2017
    Posts
    7

    Re: Matlab

    Yes....I have been searching google for quite some time.
    I finally figured it out this morning.
    Its changing the way the data is saved in the work space before passing it to the GUI using the Evalin Command

    Code:
    % --- Executes on button press in pushbutton4.
    function pushbutton4_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton4 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    t=handles.uitable5
    newdata = evalin('base', 'BatteryDischargeCalc')
    set(t, 'Data', newdata)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)