EGR 106 – Truss Design Project (cont.) Truss design programs Graphical interface tools in Matlab Saving and loading data Formatted output Project Assignment.

Slides:



Advertisements
Similar presentations
Input and Output READ WRITE OPEN. FORMAT statement Format statements allow you to control how data are read or written. Some simple examples: Int=2; real=
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
FILE TRANSFER PROTOCOL Short for File Transfer Protocol, the protocol for exchanging files over the Internet. FTP works in the same way as HTTP for transferring.
Fprintf and other examples. Save command >> !ls >> a = 3; >> save afile a >> !ls afile.mat >> !dir Directory of C:\MATLAB6p5\work\save 11/21/ :30.
General Computer Science for Engineers CISC 106 Lecture 07 Dr. John Cavazos Computer and Information Sciences 2/25/2009.
Input/Output Functions Selim Aksoy Bilkent University Department of Computer Engineering
Lecture 5 Input and Output inputfprintf © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Division Example 2x - 3y + 4z = 10 x + 6y - 3z = 4 -5x + y + 2z = 3 A*X = B where A = B = >> X = A\B X =
Input/Output Functions Selim Aksoy Bilkent University Department of Computer Engineering
EGR 106 – Project Description (cont.) Analysis of truss structures A simple example Factor of Safety calculations This week’s assignment.
Fall 2006AE6382 Design Computing1 Matlab File & Directory Management Learning Objectives Define file input and output terminology Compare high and low.
Guide To UNIX Using Linux Third Edition
EGR 106 – Project Intro / While Loop Project description Project schedule Background information / terminology A simple example Examples of similar programs.
Printing. printf: formatted printing So far we have just been copying stuff from standard-in, files, pipes, etc to the screen or another file. Say I have.
The printf Method The printf method is another way to format output. It is based on the printf function of the C language. System.out.printf(,,,..., );
Ping Zhang 10/08/2010.  You can get data from the user (input) and display information to the user (output).  However, you must include the library.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
M-files While commands can be entered directly to the command window, MATLAB also allows you to put commands in text files called M- files. M-files are.
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 4.
1 2 2 Introduction to Java Applications Introduction Java application programming –Display messages –Obtain information from the user –Arithmetic.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (3): MATLAB Environment (Chapter 1)
Constants in C A Presentation On Department of Computer & Information Technology, M.S.P.V.L. Polytechnic College, Pavoorchatram.
Introduction to File I/O High-Level Functions 1.Data files 2."High level" File I/O 3.dlmread() 4.xlsread() 1.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
File I/O High-Level Functions 1. Definition 2. Is a High-Level function appropriate? 3. xlsread() 4. dlmread() 1.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
1 Input / Output Input – reads/gets data for the program Output – the product, after processing Both can be: interactive I/O (while program is running)
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
ENG College of Engineering Engineering Education Innovation Center 1 More Script Files in MATLAB Script File I/O : Chapter 4 1.Global Variables.
GENERATION OF RANDOM NUMBERS
COMP 116: Introduction to Scientific Programming Lecture 29: File I/O.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
EGR 115 Introduction to Computing for Engineers Formatted File Input / Output Wednesday 12 Nov 2014 EGR 115 Introduction to Computing for Engineers.
Files: By the end of this class you should be able to: Prepare for EXAM 1. create an ASCII file describe the nature of an ASCII text Use and describe string.
1 STRINGS String data type Basic operations on strings String functions String procedures.
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
2016 N5 Prelim Revision. HTML Absolute/Relative addressing in HTML.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Input and Output.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
File Operations in Matlab Load / Save *.dat, *.mat vs. -ascii fopen /fclose.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 11”
Formatted I/O ä ä Standard Output ä ä printf() family of functions ä ä Standard Input ä ä scanf() family of functions.
FILE I/O: Low-level 1. The Big Picture 2 Low-Level, cont. Some files are mixed format that are not readable by high- level functions such as xlsread()
Chapter 4 Strings and Screen I/O. Objectives Define strings and literals. Explain classes and objects. Use the string class to store strings. Perform.
Introduction Every program takes some data as input and generate processed data as out put . It is important to know how to provide the input data and.
Reading and Writing Data Files
Introduction to Programming for Mechanical Engineers (ME 319)
Using Script Files and Managing Data
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
Introduction to javadoc
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Matlab Training Session 5: Importing Data
funCTIONs and Data Import/Export
Matlab.
Input/Output Functions
Introduction to javadoc
Introduction to Java Applications
Input/Output Functions
Presentation transcript:

EGR 106 – Truss Design Project (cont.) Truss design programs Graphical interface tools in Matlab Saving and loading data Formatted output Project Assignment – part #2

Examples of truss design programs Johns Hopkins University: West Point Bridge Design Contest

Graphical Interface Tools The function draw_truss will be provided to allow for graphical input of joint coordinates and member definitions To use this function: – Download the file draw_truss.m from the course web page and save it in your current directory – Include the following command in your code: [joint_def,member_def]=draw_truss

Graphical Interface: the function draw_truss

Saving data: – save filename – save filename array1 array2 – save filename –ascii Importing/Exporting Data Reading in (loading) data: – load filename – load filename array1 array2 – load filename –ascii

Importing/Exporting Data - example Saving arrays to file: >> clear >> a=[1 2 3; 4 5 6] a = >> b=[7 8 9] b = >> save arrays_a_and_b a b Loading arrays from a file: >> clear >> load arrays_a_and_b a b >> a a = >> b b = Creates file arrays_a_and_b.mat

Formatted output Formatted print command: fprintf(format,data) – Combines text and data – Allows complete control of the output – format is a string (in quotes) containing text and control commands (using \ or %) – See text pages for more details

An example: %d = put data here \n = new line The data itself Formatted output (cont.)

Escape characters: – New line ( \n ), backspace ( \b ), tab ( \t ), … Formatted output (cont.)

Conversion codes for data: – Decimal ( %d ), character ( %c ), exponential notation ( %e ), fixed precision ( %f ), … – Can add field width and precision information: 5 characters wide, 2 after the decimal point Formatted output (cont.)

fprintf works element-by-element on array data: \n added for line return Formatted output (cont.)

To write to a file: fid = fopen( 'name', 'w' ) fprintf(fid,format,data) … fclose(fid) – fid is a variable name to specify which file – name is the name of the file w indicates “write” Formatted output to a file

Truss Project – Assignment #2* Starting with your code from assignment #1: – Allow user to load results from previous design – Use function draw_truss to create new design – Develop code to allow user to define boundary conditions, forces and member width and thickness – Compute total length of members, mass of each member and total mass of truss – Allow user to save truss design – Have code create output file summarizing design parameters – Look for additional features to make your code more user friendly * See handout for details