Computational Fluid Dynamics is the Future
  • Main Page
    • Purpose of Website
    • About Me >
      • My PhD Thesis
      • My Teaching at the American University of the Middle East
      • My Teaching at the University of Sharjah
      • My Books & Codes
      • My CFD Projects
      • My SolidWorks Projects
      • My Family
      • In the Living Memory >
        • Family who contributed to My Personality
        • Lecturers Who Contributed to My Personality
      • Testimonials
    • CFD2012 Blog
    • معلومات عن الموقع
    • Page Contact >
      • Feedback Form
  • Research
    • C++ for Excel
    • Undergrad Stage Advice >
      • Cheat Sheet
      • Dealing with Dyslexia
      • Work/Research Placement
    • Masters Stage Advice >
      • PIV Lab
      • Prototype Modelling Lab
      • Field Trips 2006
      • Fuel Atomization Lab
      • Cardiff Airbus Seminar
      • Research Labs
      • GT Onsite Trips
      • On-Site Visits
    • PhD Stage Advice >
      • CFD Modelling >
        • Online CFD Codes
        • CFD Mandatory Reading List >
          • CFD Book Reviews >
            • Turbulence book Reviews
          • Turbulence Modelling Books
          • Finite Element Reading List
        • Eulerian and Lagrangian Descriptions
        • Multigrid Method
        • Finite Volume Method
        • Quantum Physics
        • Navier-Stokes Equations >
          • Atmospheric
          • CFD Simulation Validation
        • Numerical Methods >
          • Numerical Methods Book Reviews
          • Derivatives of Different Orders
          • Vector Calculus
          • Solvers >
            • Iterative Method
          • Data Structures
        • Grid Classification >
          • Mesh Geneation Book Reviews
          • Delaunay Trangulation
        • Reactive Flows >
          • Anaerobic Digestion
          • Combustion Theory Notes
          • Combustion Book Reviews
          • Swirl Flow and Combustion
          • Combustion Reading List
          • Working with Mixtures
          • Combustion Theory
      • Experimentation for CFD >
        • Diffusion Sensors
        • Experimental Wind Tunnels >
          • Wind Tunnel Walk Around
          • Wind Tunnels Books
      • Design of Experiment
      • Optimization
      • My Teaching Activities
      • Google Scholar Profile
      • Yearly Upgrade Report
      • Attending Regular Seminars >
        • Publication Reading
        • Making a Presentation
        • Research Collaboration Fundamentals >
          • Writting a Publication
          • Trip Planning
      • Supervisor Guidance >
        • Studies Budget >
          • Making a Pause for Your Studies
      • Thesis Writting >
        • Putting Together the Thesis
        • List of Symbols
        • Thesis Abstract
        • Thesis Rational and Finding the Gap
        • Thesis Literature Review
        • Thesis Methodolgy
        • Thesis Hypothesis
        • Thesis Conclusion
        • Thesis Check List
      • Referencing >
        • LaTeX
        • EndNote >
          • Setting Up EndNote with Google
          • EndNote Selecting Reference Method
      • Ideal Image of the VIVA >
        • Dealing with Correction Obstactles
        • Thesis Corrections
    • Postdoc >
      • Whitelee Windfarm
      • Dumbarton Scottish Maritime Museum
      • Meetings and Negotiating
      • Student Recommendations
      • Team Work
      • Writting a Research Proposal
      • Conference Organization
      • Research Networking
      • Supervising Students >
        • Types of PhD students >
          • Mind Mapping
    • Research Trends
    • Photoshop >
      • Inserting Text in Photoshop
      • Using Brush in Photoshop
      • Using Blur in Photoshop
    • Microsoft Office Skills >
      • Flow Chart
      • Microsoft Outlook
      • Making a Poster
      • Power Point
      • Making Gantt Chart
      • Mircosoft Word Thesis Layout >
        • Adding Rear Color in Word
        • Applying a Border Line in Word
        • Steps to Write a Thesis
        • Document Heading
        • Applying Chapter Headings
        • Document Footer
        • Using Text Box
        • Using Quick Parts
      • Microsoft Excel >
        • Reading Data into Excel
    • Jobs Search >
      • Jobs Requirments >
        • Requesting Copy of Reference
        • Work Email Formats
        • Regular Rejection Excuses >
          • Email Job Replies
      • CFD Job Sites >
        • Other Jobs Sites
      • Telephone Job Interview
      • Interview Clothing
  • ANSYS-Flow Modelling
    • ANSYS CFX Tutorials >
      • ANSYS CFX Introductory Tutorials >
        • Boundary Conditions
        • ANSYS CFX Introductory 2
      • ANSYS-CFX Porous Media >
        • ANSYS-CFX Porous Media Models
        • ANSYS-CFX Porous Media Bugs
      • ANSYS CFX Single Domain Wind Turbines >
        • ANSYS CFX Double Domain Wind Turbines
        • Rotating Wind Turbine
        • Wind Turbine Stress Analysis
      • ANSYS-CFX Turbo Machinery >
        • ANSYS-CFX Pump Simulation
        • ANSYS-CFX Turbine Cooling >
          • Steps to Model Gas Turbine Blades
      • ANSYS-CFX Formula One CAR >
        • Car Aerodynamics Books
      • ANSYS-CFX Heat Exchanger >
        • ANSYS-CFX Finned Heat Exchanger
        • Phase Change Heat Exchangers
        • Shell and Tube Heat Exchangers
        • Heat Exchangers Reading List
        • ANSYS CFX Heat Exchanger Tube Wear
        • ANSYS CFX Thermal Radiation
      • ANSYS CFX Combustion >
        • ANSYS-CFX Gas Turbine Combustor
        • ANSYS-CFX Multiphase Combustion Modelling
        • ANSYS CFX Flamelet
      • ANSYS-CFX Spary Modelling >
        • ANSYS-CFX Spray Modelling in Car Engines
        • ANSYS-CFX Resolving Multiphase Interface
        • ANSYS CFX Fluid/Solid Transport
        • ANSYS-CFX Air Assisted Sprays
        • Applying a Function of Time
        • ANSYS CFX Rosin Rammler
        • ANSYS CFX Nukiyama Tanasawa
        • SAUTER MEAN DIAMETER
      • ANSYS Geophysical Simualtions >
        • ANSYS Modelling Terrain
      • ANSYS-CFX Tank Sloshing
      • ANSYS Combustion Engines >
        • Setting up ICE Simulation
        • Applying Radiation in the Engine
      • ANSYS-CFX Pelton Turbine
      • ANSYS Flow Modelling Throttle Valve
      • ANSYS-CFX Immersed Solid
      • ANSYS CFX Changing Airfoil Para
      • ANSYS Flow around Buildings
      • ANSYS CFX Compressible Flows
      • ANSYS CFX Solid Particles
      • ANSYS Horizontal Francis Turbine
      • ANSYS-CFX Kaplan Turbine
      • ANSYS-CFX Hair Dryer
      • Types of Flaps >
        • Wings
    • ANSYS-FLUENT >
      • ANSYS FLUENT Simulation Setup >
        • ANSYS FLUENT Boundary Conditions
      • ANSYS FLUENT UDF
      • ANSYS-FLUENT Heat Exchanger Tutorial
    • ANSYS Design Modeller >
      • Blade Modelling >
        • Modelling a Turbine Blade
        • ANSYS Blade Modelling
        • ANSYS BladeGen Axial Compressor
        • ANSYS BladeGen Centrifugal Compressor
      • ANSYS Design Modeler Operations
      • ANSYS Design Modeler Boolean Operations
      • Design Modeller for Turbo Machinery
    • ANSYS CFX Meshing >
      • ICEM >
        • ICEM Introductory Tutorials
        • ICEM Surfacing
        • ICEM Parallel Meshing and Repair
        • ICEM Theory
      • Importing External Geometry to ANSYS
      • ANSYS CFX Types of Meshing >
        • Mesh (Refinement/Relevance)
        • Mesh Number of Cells
        • Mesh Types
        • Mesh Sizing
      • CFX Meshing Online Material
    • ANSYS Simulation Setup >
      • ANSYS CFX Lang CEL >
        • ANSYS-CFX Time Dependent Boundary Conditions
        • Applying a time dependent Velocity Profile
        • Inserting Equation into ANSYS
      • Workbech File Structure
      • Dealing With Memory Problems >
        • Calculating Resources
        • Calculation Guide Lines
      • Applying a Source Term
      • Applying a Velocity Profile to BC
      • Varabile Dependent Boundary Condition >
        • Time dependent Boundary Condition
        • Temperature Dependent Boundary Condition
      • Applying a Riged Body
      • CFX Data Transfer
      • CFX User Functions
      • ANSYS CFX Material Addition
    • ANSYS CFX Steady/Unsteady >
      • ANSYS CFX Time Stepping
      • Time Step Planning
      • Adaptive Time Stepping
      • Length Scale
      • Time Scale
      • Number of Iterations
      • CFL Condition
      • ANSYS CFX Transient Blade Flow
    • ANSYS CFX Data Analysis >
      • ANSYS CFX Moving Mesh >
        • ANSYS Dynamic Mesh
        • ANSYS CFX GGI Interface
      • CFD-Post >
        • CFX Point Parameter
        • ANSYS Parameter Analysis
        • Fatigue Life Optimization with ANSYS nCode DesignLife
        • ANSYS-CFX Probe Tool
        • Exporting Plane Data
        • CFD-Post Parameters
        • Using FFT for Data Analysis
        • Finding Paramters of a Close Surface
        • Histograms in CFD-Post
        • Extracting Data from a Stream Line
        • Transient or Seqence in CFD-Post
        • Linear Data Analysis in CFD-Post
        • CFD-Post Point Cloud
      • ANSYS Making Movies
      • ANSYS CFD-Post Data Loading
      • ANSYS-CFX Data Importing for Analysis
      • ANSYS Loading Simulation Data
      • ANSYS CFX Analysis Tools
      • ANSYS and Excel Data Analysis
      • Using Report Viewer
    • ANSYS Simulation Validation >
      • Flow Validation Around a Cylinder
      • Grid Sensitivity Analysis >
        • ANSYS-FLUENT Time Dependent Boundary Condition
      • Validation Steps
    • ANSYS Blogs >
      • ANSYS HPC
      • ANSYS Stress Analysis >
        • Wing Stress Analysis
        • ANSYS Mechanical APDL
        • Tail Fin Stress Analysis
        • ANSYS Stress Analysis Material >
          • Assigning Boundary Conditions
        • ANSYS Friction Modelling
        • ANSYS Static Structure
        • ANSYS Rigid Dynamics
        • ANSYS Explicit Dynamics
        • ANSYS Assembly Manager >
          • ANSYS Rigid Dynamics
  • MATLAB
    • MATLAB Control Circuits
    • MATLAB GUI
    • MATLAB Fourier Transform >
      • MATLAB Fourier Transform
    • MATLAB Numerical Analysis >
      • Newton Raphson Method
      • MATLAB Derivatives
      • Coding MATLAB EQUATIONS
    • MATLAB APPLICATION >
      • MATLAB Time Dependent Beams
      • MATLAB Hydrulic Circuts Losses
      • MATLAB Sensitivity Analysis
      • MATLAB Water Resources
      • MATLAB Reciprocating Engine
      • MATLAB Ready Polygon Data
      • MATLAB Aerofoil Lift Calculation
      • MATLAB Gas Diffusion
      • MATLAB Studying Drag
      • MATLAB Fuel Droplet Studies
      • MATLAB Atmospheric
      • MATLAB Gas Turbine Code
      • MATLAB Combustion
      • MATLAB Spray Modelling
      • MATLAB Moving Sets of Data
      • MATLAB Applying Non-Slip Conditions
      • MATLAB Fuel Gas Diffusion
      • MATLAB Landing Gear
      • MATLAB Beam Analysis >
        • MATLAB Bending of Plates
      • MATLAB Wind Analysis
      • MATLAB Code for Solar Radiation
      • MATLAB SIMULATION
    • MATLAB Data Analysis >
      • Adding Descriptive Text to Images
      • MATLAB Multiplying Two Functions
      • MATLAB Image Analysis >
        • MATLAB Image Simulation
      • MATLAB Movies >
        • MATLAB Cameras
      • MATLAB Plotting Functions
      • MATLAB PDF Methods
      • MATLAB Adding Two Functions
      • MATLAB Area Segmintation
      • MATLAB Reading Data In and Out
      • MATLAB Functions Written by User
      • COUPLING MATLAB WITH SOFTWARE
    • MATLAB FlOW MODELLING >
      • MATLAB Continuity Equation
      • MATLAB Navier Stokes Equations >
        • Navier Stokes U Velocity in 2D
      • MATLAB Flow Diffusion
      • Gauss Seidel Matlab
      • MATLAB Partical Motion
      • Matlab Gauss Elimination
      • MATLAB Ideal Gas Equation
      • MATLAB Fluid Properties
      • MATLAB Gauss-Seidel Method
      • MATLAB Boundary Layer
      • MATLAB Infinitesimal strain theory
      • MATLAB Stream Functions >
        • MATLAB Studying Vorticity
        • MATLAB 2D Heat Diffusion
      • MATLAB Atmospheric Analysis
      • MATLAB Crank Nicolson
      • Building Codes >
        • MATLAB Data Generation Algorithm
        • MATLAB DNS Subsonic Code
        • MATLAB Runge Kutta
        • MATLAB DNS Sonic Code
        • MATLAB DNS Incompressible Code
      • MATLAB Flow Applications
      • MATLAB Species Concentration
      • MATLAB Wind Flow Analysis
      • MATLAB Turbulence Modelling
      • MATLAB VECTOR FIELD PLOTS >
        • Vector Fields Sites
        • MATLAB Vector Arrow Function
        • MATLAB Vector Gradient
    • MATLAB Working with Different Coordinates >
      • MATLAB Cylindrical Coordinates
      • MATLAB Spherical Coordinates
    • MATLAB Algebric Operations >
      • MATLAB Diagonal Matrix Construction
      • MATLAB Applying Shear to a Box
      • MATLAB Rotating a Set of Points
      • MATLAB Translation
      • MATLAB Scaling a Box
    • MATLAB MESH GENERATION >
      • MATLAB GEOMETRICAL MODELLING
      • MATLAB Geometric Operations
      • MATLAB Mesh Simulation
      • Delaunay Trangulation >
        • Mesh Genration Code Trials
      • MATLAB Uniform Mesh
    • MATLAB PDE Problems >
      • MATLAB Vibrations Modelling >
        • MATLAB Harmonic Motion
        • Molecular vibration
      • MATLAB Solving ODEs
    • MATLAB Reading List
  • SolidWorks
    • AutoDesk 3ds Max
    • AutoCAD
    • Aircraft Design >
      • Aircraft Design Data Base 1
      • Aircraft Structures Books
      • Aircraft Cutaway Drawings
      • Aerodynamics Book Reviews
  • Programs
    • STAR-CCM+ Tutorials
    • FORTRAN90 >
      • The Netlib
      • Salome-Platform
    • CHEMKIN
    • OpenFoam >
      • OpenFOAM Installation
      • OpenFoam Links
    • C++ >
      • C++ Compiling Your First Code
      • C++ Delaunay Triangulation

Example  Using Matlab Interface Tools GUI

To make an interface has to have a staged approach, by asking my self is it worth the effort?

Once the objective is specified,the objective means do i want the interface just to view data, do i want to view 2D or 3D or do i want both at the same time, .....etc, do i need to change any values during the process, do i need to view some values while a simulation is run .

Next comes, making your self familer with the provided function in Matlab.

Making a quick drawing of your interface help out in knowing how many buttons are needed , and how many plots are required..... etc.

The researcher finds that their are primary aims of some buttons to use and ther are secondary aims. what is meant by primary is that the interface cant accomplish its task with thought them, secondary aims means that the interface satisfies its required goals with or without the buttons.

Examples of a visualizations interface:

clear, clc, pause,.... etc, are secondary commands

plot, contour, Meshgrid, .....etc ,are primary commands.


Using GUI just as a simple example for getting a a button menu:
This created menu has four buttons the first two buttons produce matricies of 5 or 10 cells, the thrid and fourth button makes to matrcies and stories them in an independent matrix b.


Adding buttons to the figure that help out in visualizations:


Making Calculator Interface:
http://www.intelligent-systems.info/classes/ee509/gui.htm
Using matlab interface.


Example Using GUI for Simple Algebric Operations

function varargout = simple(varargin)
% SIMPLE MATLAB code for simple.fig
%      SIMPLE, by itself, creates a new SIMPLE or raises the existing
%      singleton*.
%
%      H = SIMPLE returns the handle to a new SIMPLE or the handle to
%      the existing singleton*.
%
%      SIMPLE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SIMPLE.M with the given input arguments.
%
%      SIMPLE('Property','Value',...) creates a new SIMPLE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before simple_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to simple_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help simple

% Last Modified by GUIDE v2.5 28-Jan-2013 10:37:58

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @simple_OpeningFcn, ...
                   'gui_OutputFcn',  @simple_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before simple is made visible.
function simple_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to simple (see VARARGIN)

% Choose default command line output for simple
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes simple wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = simple_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

function input1_Callback(hObject, eventdata, handles)
% hObject    handle to input1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input1 as text
%        str2double(get(hObject,'String')) returns contents of input1 as a double
a = get(hObject,'String');
handles.a=a;
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function input1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input2_Callback(hObject, eventdata, handles)
% hObject    handle to input2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input2 as text
%        str2double(get(hObject,'String')) returns contents of input2 as a double
b = get(hObject,'String');
handles.b=b;
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function input2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input3_Callback(hObject, eventdata, handles)
% hObject    handle to input3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input3 as text
%        str2double(get(hObject,'String')) returns contents of input3 as a double
c = get(hObject,'String');
handles.c=c;
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function input3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function out1_Callback(hObject, eventdata, handles)
% hObject    handle to out1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of out1 as text
%        str2double(get(hObject,'String')) returns contents of out1 as a double

% --- Executes during object creation, after setting all properties.
function out1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to out1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function out2_Callback(hObject, eventdata, handles)
% hObject    handle to out2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of out2 as text
%        str2double(get(hObject,'String')) returns contents of out2 as a double

% --- Executes during object creation, after setting all properties.
function out2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to out2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function out3_Callback(hObject, eventdata, handles)
% hObject    handle to out3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of out3 as text
%        str2double(get(hObject,'String')) returns contents of out3 as a double

% --- Executes during object creation, after setting all properties.
function out3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to out3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton1.
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)
a = get(handles.input1,'String');
b = get(handles.input2,'String');
c = get(handles.input3,'String');

aa=2*str2num(a);
bb=str2num(a)*str2num(b);
cc=str2num(a)/str2num(b);

set(handles.out1,'String',aa);
set(handles.out2,'String',bb);
set(handles.out3,'String',cc);
guidata(hObject,handles);

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


a = get(handles.input1,'String');
b = get(handles.input2,'String');
c = get(handles.input3,'String');

set(handles.input1,'String',0);
set(handles.input2,'String',0);
set(handles.input3,'String',0);

set(handles.out1,'String',0);
set(handles.out2,'String',0);
set(handles.out3,'String',0);

clc

guidata(hObject,handles);
Picture

Example GUI Message Box

The simplest command to use is this:
msgbox('Wrong Input Value'), this can be used for conditional statements input condition. While for a more complex case if you want what inputed into the cell to be given back in the message window then type the following command
msgbox(get(hObject,'String'))
If you have an input cell by knowing whats its name:
Val=str2num(get(handles.editinput,'string'))

msgbox(num2str(val))

Some Hints:

a=str2num(get(handles.a,'string'))
b=str2num(get(handles.b,'string'))
c=str2num(get(handles.c,'string'))
int=num2str(c/b);
slope=num2str(-a/b);
set(handles.y,'string',int);
set(handles.slope,'string',slope);
x=0:10;
y=c/b-a/b*x;
axes(handles.axes1)
plot(x,y);
xlabel('x');
ylabel('y');
guidata(hObject.handles)


Some useful links:

1-http://www.youtube.com/watch?v=pPcaxvPUtBg
2-http://www.youtube.com/watch?v=I-JP24_VF58
3-http://www.youtube.com/watch?v=u06LwtHIh6Q
4-http://www.youtube.com/watch?v=60zHJ1sEFhQ

5-http://www.youtube.com/watch?v=D_hmws6dwgg
6-http://www.youtube.com/watch?v=KPQZzPp03Rg

Summary:

some cells are required for input, you need to tag them with a name so that you can call them through the call back function. Remmber that the values need to be read in and then stored to be recalled during other needed operations, therefore these cells will need to be first assigned a value by the user and then the user has to press a button. Meaning a button needs to be made that has a call back function to read the values in the input cells. The user has to go to the call back function for the created button and use a command to read in the required values as an example the following
get(handles.input1,'String');

There will be a need at some point to perform some algebric operations therefore it is required to assign the command to a string
A1 = get(handles.input1,'String');

This is still the first step, if the user types into MATLAB A1 he will get zero. The next step is to use the following command str2num(A1) this will inturn enable the user to perform algebric operations becouse matlab will interpert A1 to a value.
So the cell is regarded after being added as a  function input1_callback(hObject, eventdata, handles)
input1=str2double(get(hObject,'strin'))
The majority of studied cases there is a need use a conditional statement to get the correct the input parameters
if isnan(input)
set(hObject,'string',0);
errordlg('Input must be a number','Error');
end
handles.metricdata.input1=input1;
guidata(hObject,handles)

Next comes using a calculate button :
function calculate_Callback(hObject,eventdata,handles)
mass=handles.inpu1*handles.input2
set(handles.mass,'String',mass)


Some options to change the unit texts, so by selecting, this function checks the selected option once this is selected the following commands are implmented.

function xx_SelectionChangeFcn(hObject, eventdata,handles)
if (hObject == handles.english)
set(handles.text4, 'String','Kg');
set(handles.text5, 'String','m');
set(handles.text6, 'String','N');
else
set(handles.text4, 'String','Ib');
set(handles.text4, 'String','foot');
set(handles.text4, 'String','Kg');
end


There is always a need to reset the values for the gui window to allow another calculation to be done:

function initialize_gui(fig_handle, handles,isreset)
if isfield(handles,'metricdata') && ~isreset
return;
end
handles.metricdata.density=0;
handles.metricdata.volume=0;

set(handles.density, 'string', handles.metricdata.density);
set(handles.volume, 'string', handles.metricdata.volume);
set(handles.mass, 'string', 0);

set(handles.text6, 'string', 'N');

set(handles.text4, 'string', 'kg');
set(handles.text5, 'string', m');
set(handles.text6, 'string', 'N');
guidata(handles.figure1, handles)


Example Using MATLAB GUI for Studing Methane Heat Capacity

function varargout = Methane(varargin)
% METHANE MATLAB code for Methane.fig
%      METHANE, by itself, creates a new METHANE or raises the existing
%      singleton*.
%
%      H = METHANE returns the handle to a new METHANE or the handle to
%      the existing singleton*.
%
%      METHANE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in METHANE.M with the given input arguments.
%
%      METHANE('Property','Value',...) creates a new METHANE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Methane_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Methane_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Methane

% Last Modified by GUIDE v2.5 26-Jan-2013 11:41:23

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Methane_OpeningFcn, ...
                   'gui_OutputFcn',  @Methane_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before Methane is made visible.
function Methane_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to Methane (see VARARGIN)

% Choose default command line output for Methane
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Methane wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = Methane_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

function input1_Callback(hObject, eventdata, handles)
% hObject    handle to input1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input1 as text
%        str2double(get(hObject,'String')) returns contents of input1 as a double
A1 = get(hObject,'String');
handles.A1=A1
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input2_Callback(hObject, eventdata, handles)
% hObject    handle to input2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input2 as text
%        str2double(get(hObject,'String')) returns contents of input2 as a double
A2 = get(hObject,'String');
handles.A2=A2
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input3_Callback(hObject, eventdata, handles)
% hObject    handle to input3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input3 as text
%        str2double(get(hObject,'String')) returns contents of input3 as a double
A3 = get(hObject,'String');
handles.A3=A3
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input4_Callback(hObject, eventdata, handles)
% hObject    handle to input4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input4 as text
%        str2double(get(hObject,'String')) returns contents of input4 as a double
A4 = get(hObject,'String');
handles.A4=A4
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input5_Callback(hObject, eventdata, handles)
% hObject    handle to input5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input5 as text
%        str2double(get(hObject,'String')) returns contents of input5 as a double
A5 = get(hObject,'String');
handles.A5=A5
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input6_Callback(hObject, eventdata, handles)
% hObject    handle to input6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input6 as text
%        str2double(get(hObject,'String')) returns contents of input6 as a double
A6 = get(hObject,'String');
handles.A6=A6
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input7_Callback(hObject, eventdata, handles)
% hObject    handle to input7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input7 as text
%        str2double(get(hObject,'String')) returns contents of input7 as a double
tMIN = get(hObject,'String');
handles.tMIN=tMIN
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input8_Callback(hObject, eventdata, handles)
% hObject    handle to input8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input8 as text
%        str2double(get(hObject,'String')) returns contents of input8 as a double
tMAX = get(hObject,'String');
handles.tMAX=tMAX
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input9_Callback(hObject, eventdata, handles)
% hObject    handle to input9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input9 as text
%        str2double(get(hObject,'String')) returns contents of input9 as a double
M = get(hObject,'String');
handles.M=M;
guidata(hObject,handles)

% --- Executes during object creation, after setting all properties.
function input9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function input10_Callback(hObject, eventdata, handles)
% hObject    handle to input10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of input10 as text
%        str2double(get(hObject,'String')) returns contents of input10 as a double
Molecular_Weight = get(hObject,'String');
Molecular_Weight

% --- Executes during object creation, after setting all properties.
function input10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
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)
% Access the globally stored data
CP=handles.CP
T=handles.T
plot(T,CP,'-')
grid on
xlabel('T (K)','FontSize',12)
ylabel('CP (KJ/Kmol.K)','FontSize',12)
%legend('Specfic Heat for CH_4')
title('Specfic Heat Capcity at Constat Pressure for CH_4','FontSize',12)

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a = get(handles.input1,'String');
b = get(handles.input2,'String');
c = get(handles.input3,'String');
d = get(handles.input4,'String');
e = get(handles.input5,'String');
f = get(handles.input6,'String');
g = get(handles.input7,'String');
h = get(handles.input8,'String');
i = get(handles.input9,'String');
j = get(handles.input10,'String');

set(handles.input1,'String',0);
set(handles.input2,'String',0);
set(handles.input3,'String',0);
set(handles.input4,'String',0);
set(handles.input5,'String',0);
set(handles.input6,'String',0);
set(handles.input7,'String',0);
set(handles.input8,'String',0);
set(handles.input9,'String',0);
set(handles.input10,'String',0);
guidata(hObject, handles);
clc
clear
cla
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
A1 = get(handles.input1,'String');
A2 = get(handles.input2,'String');
A3 = get(handles.input3,'String');
A4 = get(handles.input4,'String');
A5 = get(handles.input5,'String');
A6 = get(handles.input6,'String');
tMIN = get(handles.input7,'String');
tMAX = get(handles.input8,'String');
M = get(handles.input9,'String');
Molecular_Weight = get(handles.input10,'String');

set(handles.input1,'String',-0.29149);
set(handles.input2,'String',26.327);
set(handles.input3,'String',-10.610);
set(handles.input4,'String',1.5656);
set(handles.input5,'String',0.16573);
set(handles.input6,'String',-18.33);
set(handles.input7,'String',-15.1500);
set(handles.input8,'String',900);
set(handles.input9,'String',1000);
set(handles.input10,'String',16);

guidata(hObject,handles)
TMIN=273+tMIN;
TMAX=273+tMAX;
dt=(TMAX-TMIN)/M;
Dt(1)=TMIN;
for i=1:M+1;
Dt(i+1)=Dt(i)+dt;
TH(i)=Dt(i+1)/1000;
CP(i)=4.184*(A1+A2*TH(i)+A3*(TH(i))^2+A4*(TH(i))^3+A5*(TH(i))^-2)/16;
end
T=(TMIN:dt:TMAX);

% Store the data in handles as a structure to be able to access it globally
% from other functions
handles.CP=CP;
handles.T=T;
guidata(hObject,handles)

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
A1 = get(handles.input1,'String');
A2 = get(handles.input2,'String');
A3 = get(handles.input3,'String');
A4 = get(handles.input4,'String');
A5 = get(handles.input5,'String');
A6 = get(handles.input6,'String');
tMIN = get(handles.input7,'String');
tMAX = get(handles.input8,'String');
M = get(handles.input9,'String');
Molecular_Weight = get(handles.input10,'String');
TMIN=273+str2num(tMIN);
TMAX=273+str2num(tMAX);
dt=(TMAX-TMIN)/str2num(M);
Dt(1)=TMIN;
for i=1:str2num(M)+1;
Dt(i+1)=Dt(i)+dt;
TH(i)=Dt(i+1)/1000;
CP(i)=4.184*(str2num(A1)+str2num(A2)*TH(i)+str2num(A3)*(TH(i))^2+str2num(A4)*(TH(i))^3+str2num(A5)*(TH(i))^-2)/str2num(Molecular_Weight);
end
T=(TMIN:dt:TMAX);
handles.CP=CP;
handles.T=T;
guidata(hObject,handles)
You can downlaod the Code by pressing on the picture:
Picture
You can downlaod the template by pressing on the picture:
Picture

Unless otherwise noted, all content on this site is @Copyright by Ahmed Al Makky 2012-2013 - http://cfd2012.com
Web Hosting by Just Host