Display window for text file

Target: Visualize a text file inside a box which has a scrollbar.

댓글 수: 4

Jan
Jan 2011년 10월 28일
The question is not clear. The actual problem is concealed by numerous details: "three exclusive selection panels". "Position, velocity, Acceleration", "all latter variables are dependent ones", "popup menu", ...
As far as I understand you want to display text in a box, which has a scrollbar.
Answering is much more efficient, if unneccesary details are omitted.
If you really want to accept your own question, please be so kind and publich the code of the solution also. Currently neither the question nor the answer is useful for others.
Julián Francisco
Julián Francisco 2011년 10월 28일
@Jan Simon: I think you have forgot to see the adjunct image (it is very clarifying).
Jan
Jan 2011년 10월 28일
@Julian: No, the image does not describe the problem "the report creation and display inside the window" at all. The image show exactly the part of your program, which is working perfectly already. But the part, which does not work is not visible, is it?
What does "use column vectors for the selected variables" mean?
Julián Francisco
Julián Francisco 2011년 10월 28일
Ok, you are right in that sense. If my selected variables are, for example, component x and component z of the position, these are stored in column vectors. My intention is writing these vectors as columns inside the box.

댓글을 달려면 로그인하십시오.

 채택된 답변

Julián Francisco
Julián Francisco 2011년 10월 28일

0 개 추천

Here is the solution for a generic archive called 'textfile.txt':
f = figure('menu','none','toolbar','none');
fid = fopen('textfile.txt');
ph = uipanel(f,'Units','normalized','position',[0.4 0.3 0.5 0.5],'title',...
'Display window');
lbh = uicontrol(ph,'style','listbox','Units','normalized','position',...
[0 0 1 1],'FontSize',9);
indic = 1;
while 1
tline = fgetl(fid);
if ~ischar(tline),
break
end
strings{indic}=tline;
indic = indic + 1;
end
fclose(fid);
set(lbh,'string',strings);
set(lbh,'Value',1);
set(lbh,'Selected','on');

댓글 수: 4

Walter Roberson
Walter Roberson 2011년 10월 28일
You can use an edit box with 'Enable' set to 'disable'. That will generate the scrollbar you are looking for but will not allow the user to edit the text.
Julián Francisco
Julián Francisco 2011년 10월 28일
@Walter Roberson: Can an edit box show all the content of a text file?
Jan
Jan 2011년 10월 28일
The contents of a text file are characters. Yes, an editbox can display all characters.
Julián Francisco
Julián Francisco 2011년 10월 28일
@Jan Simon: Thank you for the clarifying comment.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by