필터 지우기
필터 지우기

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에서 Scope Variables and Generate Names에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by