카테고리 없음2013. 4. 2. 20:47

function userDraw(handles)
%F=figure;
%setptr(F,'eraser'); %a custom cursor just for fun

A=handles.axesUserDraw; % axesUserDraw is tag of my axes
set(A,'buttondownfcn',@start_pencil)

function start_pencil(src,eventdata)
coords=get(src,'currentpoint'); %since this is the axes callback, src=gca
x=coords(1,1,1);
y=coords(1,2,1);

r=line(x, y, 'color', [0 .5 1], 'LineWidth', 2, 'hittest', 'off'); %turning     hittset off allows you to draw new lines that start on top of an existing line.
set(gcf,'windowbuttonmotionfcn',{@continue_pencil,r})
set(gcf,'windowbuttonupfcn',@done_pencil)

function continue_pencil(src,eventdata,r)
%Note: src is now the figure handle, not the axes, so we need to use gca.
coords=get(gca,'currentpoint'); %this updates every time i move the mouse
x=coords(1,1,1);
y=coords(1,2,1);
%get the line's existing coordinates and append the new ones.
lastx=get(r,'xdata');  
lasty=get(r,'ydata');
newx=[lastx x];
newy=[lasty y];
set(r,'xdata',newx,'ydata',newy);

function done_pencil(src,evendata)
%all this funciton does is turn the motion function off 
set(gcf,'windowbuttonmotionfcn','')
set(gcf,'windowbuttonupfcn','')
참고 : http://we15hang.blogspot.ca/2012/04/matlab-gui-interactive-drawing.html

Posted by 오늘보다 나은 내일
카테고리 없음2013. 3. 29. 21:06

xl=get(handles.axes1, 'xlim');          yl = get(handles.axes1, 'ylim');

 

 

Working on multislides form

 

 

first go to openingFcn callback and set all uipanel visibile to off except the 1st one which is uipanel1. Here it is just one panel uipanel2

 

function gui1_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% Choose default command line output for gui1

handles.output = hObject;

set(handles.uipanel2,'Visible','Off');

% Update handles structure

guidata(hObject, handles);

 

Now go to pushbutton1 (Next Button ) callback and set the uipanel1 visible to off and uipanel2 visible to on. That way when you click on next button, second one will appear and first will disappear. Remember you are just making it in invisible.. All the data which you have entered is as it were.. no harm to them. 

 

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

set(handles.uipanel2,'Visible','On');

set(handles.uipanel1,'Visible','Off');

 

Do the same for pushbutton2 callback but other way around

 

function pushbutton2_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

set(handles.uipanel1,'Visible','On');

set(handles.uipanel2,'Visible','Off');


 

Posted by 오늘보다 나은 내일
카테고리 없음2013. 3. 12. 15:39

Header Image


Fracture & Fatigue Overview and Analysis Methods in Fatigue/Fracture 

Low and High Cycle Fatigue: Stress–Life, Strain-Life, nCode Case Study 

Fatigue Crack Propagation: nCode 

Automated Methodology For Modeling Crack Extension in Finite Element Models 

Cohesive Zone Modeling 

Virtual Crack Closure Technology in ANSYS

High Performance Computing and Fatigue Analysis 

 http://www.caeai.com/engineering-analysis-fatigue-seminar.php


Posted by 오늘보다 나은 내일