Display window for text file

4 views (last 30 days)
Target: Visualize a text file inside a box which has a scrollbar.
  4 Comments
Jan
Jan on 28 Oct 2011
@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 on 28 Oct 2011
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.

Sign in to comment.

Accepted Answer

Julián Francisco
Julián Francisco on 28 Oct 2011
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 Comments
Jan
Jan on 28 Oct 2011
The contents of a text file are characters. Yes, an editbox can display all characters.
Julián Francisco
Julián Francisco on 28 Oct 2011
@Jan Simon: Thank you for the clarifying comment.

Sign in to comment.

More Answers (0)

Categories

Find more on Text Analytics Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!