Matlab Class 6 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS) and Chris Kourtev.

Slides:



Advertisements
Similar presentations
Matlab Intro Simple introduction to some basic Matlab syntax. Declaration of a variable [ ] Matrices or vectors Some special (useful) syntax. Control statements.
Advertisements

How to Import Names into GradeCam By Monica Dixon.
Part 2.  Enter formulas  Select Cells  Format Cell Contents  Insert Borders  Standard Error Values & How to Correct  Format Numbers.
Matlab Class 5 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS)
Pre-defined System Functions Simple IF & VLOOKUP.
A Visual Follow-Along Guide to the Instructions of the NBTA Modular Hotel RFP.
Matlab DIY Lesson 3: Parsing data. Today's Lesson “ parse ” = analyze into its parts o Sort the data you want MATLAB to use o Designate different segments.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.
Designing a Database Unleashing the Power of Relational Database Design.
Microsoft Access 2007 Microsoft Access 2007 Introduction to Database Programs.
Pasewark & Pasewark 1 Access Lesson 6 Integrating Access Microsoft Office 2007: Introductory.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
1 Access Lesson 6 Integrating Access Microsoft Office 2010 Introductory Pasewark & Pasewark.
Programming in R Getting data into R. Importing data into R In this session we will learn: Some basic R commands How to enter data directly into R How.
Matlab Class 7 Hristiyan Kourtev & Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS)
Excel Spreadsheet basics. Excel Sheets and Books  Spreadsheet: tool to analyze, chart and manage data for personal, business and financial use Worksheet:
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
Chapter 19 Managing Worksheet Lists. Creating Lists ► Microsoft Office Excel 2003 is inarguably the most powerful electronic spreadsheet available. ►
Basic File Input and Output Copyright © Software Carpentry 2011 This work is licensed under the Creative Commons Attribution License See
Two dimensional arrays in Java Computer Science 3 Gerb Objective: Use matrices in Java.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
10.11 Data Manipulation 1. Getting External Data.
Lesson 2 Topic - Reading in data Chapter 2 (Little SAS Book)
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.
Feedback ELearning in Sakai. Feedback UseExport GradebookWorking in ExcelPost FileView FeedbackUpdate, Download, or Delete.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
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.
Introduction To Matlab Class 4 Instructors: Hristiyan (Chris) Kourtev and Xiaotao Su, PhD Double click the matlab icon When prompted click “Skip”
MATLAB for Engineers, by Holly Moore. ISBN © 2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is.
A table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows.
Export/Import of TurningPoint Session Files II: Exporting.tpz (Session) Files to csv Files Ready for Import into D2L Tanya Joosten and Gerald Bergtrom.
Early File I/O To help you get started with your final project 1. Definition of “high level” 2. Is using a High Level function appropriate? 3. xlsread()
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
More Oracle SQL Scripts. Highlight (but don’t open) authors table, got o External data Excel, and make an external spreadsheet with the data.
1 CSE 2337 Chapter 7 Organizing Data. 2 Overview Import unstructured data Concatenation Parse Create Excel Lists.
Matlab Class 4 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS) and Chris Kourtev.
Introduction To Matlab Class 5 Instructors: Hristiyan (Chris) Kourtev and Xiaotao Su, PhD.
How to Create a form using the Program Excel By Mrs Douglas 8/1/10.
An Introduction to Programming in Matlab Emily Blumenthal
Matlab Class 8 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS) and Chris Kourtev.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Working with files Saving and loading Matlab variables to and from .mat files does not require any special file handling, just use save() and load() However,
ECE 1304 Introduction to Electrical and Computer Engineering
Creates the file on disk and opens it for writing
Introduction to Matlab
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
By Shivgan Joshi Qcfinance.in
After completing this lesson, you will be able to:
Matlab Class 2 Xiaotao Su, Ph. D
Select Your Meeting Export Your Contacts From Outlook How to create a csv contact file from Outlook to import into Select Your Meeting
Bonus Excel Tip Students may have more than one row in a SIS or EMIS report Add a new column next to SSID (Column D for this example) Enter this Formula.
Data File Import / Export
Access Lesson 14 Import and Export Data
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Introduction To Matlab Class 1
Jeff Henrikson Lecture 11 Data Import & Export Jeff Henrikson 1.
Matlab Class 6 Xiaotao Su, Ph. D
Introduction To Matlab Class 7
Advanced Data Import & Export Jeff Henrikson
Vendor Portal Upload Process
Bonus Excel Tip Students may have more than one row in a SIS or EMIS report Add a new column next to SSID (Column D for this example) Enter this Formula.
Creates the file on disk and opens it for writing
Communication and Coding Theory Lab(CS491)
Bonus Excel Tip Students may have more than one row in a SIS or EMIS report Add a new column next to SSID (Column D for this example) Enter this Formula.
funCTIONs and Data Import/Export
Presentation transcript:

Matlab Class 6 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS) and Chris Kourtev

RuCCS Managing data To manage basic numerical data we use matrices our_data = [1, 4, 10.59, 12; 2, 9, 18.76, 5; 3, 7, 1.13, 2]; Trial 1 Trial 2 Trial 3 Response 1 Response 2 (perhaps the response time) Response 3 Trial Number

RuCCS our_data = [1, 4, 10.59, 12; 2, 9, 18.76, 5; 3, 7, 1.13, 2]; To set the 4th row (4th trial) data: our_data(4, :) = [4, 7, 2.93, 3] –or we could our_data(5, 1) = 5; our_data(5, 2) = 1; our_data(5, 3) = 2.10; our_data(5, 4) = 9; To get this 4th row data –trial_data = our_data(4, :) : gets or sets all elements from row or column

RuCCS %guessing_game.m %test to see if subject is psychic clear all; %settings num_trials = 5; highest_number = 3; %get info subject_name = input('What is your name?', 's'); for t = 1:num_trials %trial set up random_num = ceil(rand*highest_number); %perform experiment start_time = GetSecs; disp('I am thinking of a number between'); disp([' 1 and ', num2str(highest_number)]); response = input('What is it?'); stop_time = GetSecs; response_time = stop_time - start_time; is_correct = (response==random_num); if(is_correct) disp('Right!'); else disp(['Wrong! The correct answer was ',... num2str(random_num)]); end disp('Press any key to continue'); pause disp(' '); %record data guessing_game_data(t, :) =... [t, response_time, response,... random_num, is_correct ]; end

RuCCS %guessing_game.m %test to see if subject is psychic clear all; %settings num_trials = 5; highest_number = 3; %get info subject_name = input('What is your name?', 's'); for t = 1:num_trials %trial set up random_num = ceil(rand*highest_number); %perform experiment start_time = GetSecs; disp('I am thinking of a number between'); disp([' 1 and ', num2str(highest_number)]); response = input('What is it?'); stop_time = GetSecs; response_time = stop_time - start_time; is_correct = (response==random_num); if(is_correct) disp('Right!'); else disp(['Wrong! The correct answer was ',... num2str(random_num)]); end disp('Press any key to continue'); pause disp(' '); %record data guessing_game_data(t, :) =... [t, response_time, response,... random_num, is_correct ]; end Task 1: Write this section of the program Hint: input without ‘s’ is a good way To get numeric responses from The subject

RuCCS %guessing_game.m %test to see if subject is psychic clear all; %settings num_trials = 5; highest_number = 3; %get info subject_name = input('What is your name?', 's'); for t = 1:num_trials %trial set up random_num = ceil(rand*highest_number); %perform experiment start_time = GetSecs; disp('I am thinking of a number between'); disp([' 1 and ', num2str(highest_number)]); response = input('What is it?'); stop_time = GetSecs; response_time = stop_time - start_time; is_correct = (response==random_num); if(is_correct) disp('Right!'); else disp(['Wrong! The correct answer was ',... num2str(random_num)]); end disp('Press any key to continue'); pause disp(' '); %record data guessing_game_data(t, :) =... [t, response_time, response,... random_num, is_correct ]; end

RuCCS %guessing_game.m %test to see if subject is psychic clear all; %settings num_trials = 5; highest_number = 3; %get info subject_name = input('What is your name?', 's'); for t = 1:num_trials %trial set up random_num = ceil(rand*highest_number); %perform experiment start_time = GetSecs; disp('I am thinking of a number between'); disp([' 1 and ', num2str(highest_number)]); response = input('What is it?'); stop_time = GetSecs; response_time = stop_time - start_time; is_correct = (response==random_num); if(is_correct) disp('Right!'); else disp(['Wrong! The correct answer was ',... num2str(random_num)]); end disp('Press any key to continue'); pause disp(' '); %record data guessing_game_data(t, :) =... [t, response_time, response,... random_num, is_correct ]; end

RuCCS CSV format Stands for “Comma separated value” It is a simple text file for data storage Each data item is delimited (separated) by a comma Each data row is delimited by a return character

RuCCS Notepad example Start->run notepad 1, 4, 9.3 1, 9, 100 4, 0, 12 Save as test.csv Double click -> opens in excel

RuCCS csvwrite saves a 2d matrix as a csv file csvwrite(FILENAME, MATRIX_VAR) my_matrix = [3, 5; 1, 2]; csvwrite(‘my_data.csv’, my_matrix);

RuCCS %guessing_game.m %test to see if subject is psychic clear all; %settings num_trials = 5; highest_number = 3; %get info subject_name = input('What is your name?', 's'); for t = 1:num_trials %trial set up random_num = ceil(rand*highest_number); %perform experiment start_time = GetSecs; disp('I am thinking of a number between'); disp([' 1 and ', num2str(highest_number)]); response = input('What is it?'); stop_time = GetSecs; response_time = stop_time - start_time; is_correct = (response==random_num); if(is_correct) disp('Right!'); else disp(['Wrong! The correct answer was ',... num2str(random_num)]); end disp('Press any key to continue'); pause disp(' '); %record data guessing_game_data(t, :) =... [t, response_time, response,... random_num, is_correct ]; end %data_storage csvwrite([subject_name, '.csv'], … guessing_game_data);

RuCCS csvread clear all; my_matrix = csvread(‘my_data.csv’); can be used to load parameters at the beginning of a program can be used to load data to analyze through matlab

RuCCS cell arrays this_is_a_matrix_and_a_vector = [5, 3, 9, 3] and_so_is_this = [‘hello’]; which_is_the_same_as = [‘h’, ‘e’, ‘l’, ‘l’, ‘o’];

RuCCS cell arrays cell array provides a storage mechanism for dissimilar kinds of data they are like a matrix where each element is any other data type example_cell_array = {‘cat’, 3, [5, 9]; ‘zebra’, [10, 3; 9, 5], ‘dog’}; ‘cat’3 ‘zebra’‘dog’

RuCCS a = example_cell_array{2, 3} example_cell_array{2, 1} = a example_cell_array{2, 2}(2, 1) ‘cat’3 ‘zebra’‘dog’

RuCCS Next class saving cell arrays as csv in class project