Hi everyone, This is the Second question of a series of questions to complete a project. The First question can be found here . The Third question is accessible here.
I am building the GUI, right now I am at the point you can see in the picture and I am testing "à côté" small bunches of code that i subsequently integrate in the main GUI.
I am having problems to integrate the function that says what happens when the box is checked in the GUI (function boxchecked). In the code below it works fine but when I integrate it in my GUI code it says that some function were not closed with an end statement. I was trying to create the function in a new .m script but I am really noob at this and I can't figure out how to pass the variables.
Attached you can find my GUI program. To test it just create a file text to open. Thanks to all of you helping all of us, you are the best!
function myui f = figure; A = {'a.txt'}; B = {false}; myData = [A B]; t = uitable('Parent',f,... 'Position', [25 25 700 200], ... 'Data',myData,... 'ColumnEditable', [false true], ... 'CellEditCallback',@boxchecked; % create cell files of the size of the .TRA files
files = cell(length(A),2); function boxchecked(hObject,eventdata) if eventdata.NewData == 1 % read the file only if it isn't already there
if isempty(files{eventdata.Indices(1),1}) fName = myData(eventdata.Indices(1),1); fileName = fopen(fName{1,1}, 'r'); C = textscan(fileName, '%s %s %s', 'Delimiter', ';'); % create two subcells in files at the index eventdata containing the force and displacement
for i = 1:length(C{1,1})-17 files{eventdata.Indices(1),1}{i,1} = str2num(C{1,1}{i+17}); files{eventdata.Indices(1),2}{i,1} = str2num(C{1,2}{i+17}); end end f1 = cell2mat(files{1,1}); f2 = cell2mat(files{1,2}); plot(f1,f2) end end end
Best Answer