카테고리 없음2013. 4. 3. 22:32

function [] = pb_call(varargin)

h = varargin{1}; % Get the caller's handle.

col = get(h,'backg');  % Get the background color of the figure.

set(h,'str','RUNNING...','backg',[1 .6 .6]) % Change color of button. 

% The pause (or drawnow) is necessary to make button changes appear.

% To see what this means, try doing this with the pause commented out.

pause(.01)  % FLUSH the event queue, drawnow would work too.

% Here is where you put whatever function calls or processes that the

% pushbutton is supposed to activate. 

% Next we simulate some running process.  Here just sort a vector.

A = rand(30000000,1);

A = sort(A); %#ok 

set(h,'str','Push Me','backg',col)  % Now reset the button features.

Posted by 오늘보다 나은 내일
카테고리 없음2013. 4. 3. 11:10

deploytool 을 사용하면 쉽게 standalone file 생성 가능

Posted by 오늘보다 나은 내일
카테고리 없음2013. 4. 3. 00:42

!----------------------------------------------------------

! uigetfile

!----------------------------------------------------------

[file_name,file_path] = uigetfile('*.txt','Select Input File');
if (file_name ~=0)
    full_name=sprintf('%s%s',file_path,file_name);
    fid=fopen(full_name,'rw');
    data=fscanf(fid,'a %g %g %g %g ',[4,inf]);
    data=data';
    fclose(fid);   
else
    return
end

 

!----------------------------------------------------------

! uiputfile

!----------------------------------------------------------

[file_name,file_path] = uiputfile('*.txt','Save data As');
if (file_name ~=0)
    full_name=sprintf('%s%s',file_path,file_name);
    fid=fopen(full_name,'rw');
    fprintf(fid,'%d %d %d \n',data' );
    fclose(fid);   
else
    return
end

 

!----------------------------------------------------------

! multiple file select

!----------------------------------------------------------

[file,path] = uigetfile('*.txt','load data file','Multiselect','on');

 

!----------------------------------------------------------

! data in out

!----------------------------------------------------------

data=load('file_name.txt');

file_name = sprintf('%d.txt',str2double('xxxxxxx'));

 

 

t=linspace(0:100:100); 

f=@(t) 10*exp(-0.25*t).*sin(t-4);

 

Posted by 오늘보다 나은 내일