Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to: Get file in different functions

Asked by Hello kity on 28 Dec 2012

Hi,

in this menu i select a file.

   function OpenMenuItem_Callback(hObject, eventdata, handles)
    % hObject    handle to OpenMenuItem (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     [filename, pathname] = uigetfile({'*.xls'},'File Selector');

i want that file(name) used in different m-files.

    function pushbutton1_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    popup_sel_index = get(handles.popupmenu1, 'Value');
how do i get filename here????
    switch popup_sel_index
         case 1
    AnotherMfile
    end

so lets say

function AnotherMfile

what to type here to get filename??

    [num, txt]=xlsread(filename);
end

0 Comments

Hello kity

Products

No products are associated with this question.

Contact us