Clear Filters
Clear Filters

Beginner Check-box help

1 view (last 30 days)
Melvin
Melvin on 24 Jun 2013
Good morning everyone,
I am working on a GUI that displays data opened from a folder. All of the .txt files within that folder are imported and the data is extracted from it. That part I managed to complete, but I need now to extract specific parts of these .txt files and display them in a table w/ check boxes, i.e. Pixel Size. I used the 'strmatch' function (Matlab v. R2010b) to locate the line that starts with 'Pixel size', but when I check the box, it only displays the data from the first .txt file found. How can I get it to display all of the data? I also don't know how to program the unchecking part of the callback. I want the unselected data to disappear from the table.
for i = 1:l
PSize = strmatch('Pixel size',S{i}{1});
i=i+1;
end
if(get(hObject,'Value') == get(hObject,'Max'))
for i = 1:l
set(uitable1,'Data',{S{i}{1}{PSize(1)}});
i=i+1;
end
else
%Unchecking the checkbox clears the Pixel Size data
end
Thank you in advance

Answers (1)

Jan
Jan on 24 Jun 2013
Edited: Jan on 24 Jun 2013
You cannot modify the loop counter of FOR loops in Matlab:
for i = 1:5
disp(i)
i = i + 1;
end
This shows the number from 1 to 5, and the increasing of i insider the loop has no effect. I do not know if this addresses your problem, but it is at least another problem.
What is the value of "l"?
  1 Comment
Melvin
Melvin on 25 Jun 2013
I realized this, and I removed that line from my code. I also figured out how to add data to a table, but I encountered a new problem. When I added a second check-box, let's call this one 'Lower Grey Threshold', when one check-box is checked, and the second check-box is checked, it replaces the first data. How to I program the check-boxes to add data to the table instead of replace the data already there? Thanks

Sign in to comment.

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!