Beginner Check-box help

1 次查看(过去 30 天)
Melvin
Melvin 2013-6-24
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

回答(1 个)

Jan
Jan 2013-6-24
编辑:Jan 2013-6-24
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 个评论
Melvin
Melvin 2013-6-25
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by