Matlab GUI question

Discussion in 'Programmer's Corner' started by Ron_7, Mar 13, 2007.

  1. Ron_7

    Thread Starter New Member

    Dec 18, 2006
    8
    0
    hello guys,

    just wondering if anyone knows how to output the contents of a .dat or .txt file into a text box in a matlab gui.

    i've used the following to create a .dat or .txt file.

    fiw = fopen('watermarks.txt','wt');
    fprintf(fiw,'\n watermark # %d = %s position = %d',kk,str,POSITION(kk));

    i'm currently outputing to the command window using :

    disp(sprintf(' watermark # %d = %s position = %d',kk,str,POSITION(kk)));

    Thanks in advance

    Ron
     
  2. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    143
    If the text you wish to write to the text box is in String format then just set the handles for that textbox. For example:

    If you have a textbox called textbox, and the String that you wish to write to it is in the variable var, then to write the String to the text box you would write:

    set(handles.textbox,'String'
    ,var);

    When the function to create/update the textbox/GUI is called the text will be written to the textbox.

    Dave
     
  3. Ron_7

    Thread Starter New Member

    Dec 18, 2006
    8
    0
    Many Thanks Dave ur a star. This has done the trick!
     
Loading...