NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

HW_5 Part 2:
MSG---> user
updated key--> made this go through msg. letter by letter
apply math from announcement

HW_6 is different: Code Debugging Homework
Fixing mistakes in code that's already written
**A New Play fair Cipher code with mistakes**

HW6 + HW7 --> matrices
(1D data: vectors and strings)
(2D data: plotting/graphing x vs. y, excel)
(3D data: modelling, solid-works, images (rows vs. color )

Syntax for 2D:
variable = [ values ; values... ];
(where values = numbers or letters--> single quotes needed)
(where the ";" means create new row)

1 2
3 4
5 6
3 x 2 (rows vs. columns 2D matrix)
table = [1 2; 3 4; 5 6] . . .**(all rows must have same length)**
(can use a space or comma to separate values)

How to change / update values in a matrix???
(2 spots)---> what row? what column? (3D matrices---> 3 spots)
variable (row , column) = #

For vectors---> length
For matrices---> size
syntax: [rows, cols] = size(variable); (left hand side must be in brackets to get back both options)

Special Matrix Commands---> :operator
variable( : , # ) ; variable ( #, : );
where "#" means column you want, and ":" means all of
where "#" means row you want, and ":" means all of

Multiply Vectors:
vecotr .* vector ( the dot fixed issues so it mulyiplies element by element

**** GO TO MATLAB COMMAND WINDOW ****
table = [2 5 6 ; 7 8 9 ; -1 4 5]
to change the 8 to 22--->type table(2 , 2) = 22
table (end, end) = 45 to change last row, last column
[rows,cols] = size(table) ---> row = 3, column = 3 or even [ii,jj]

table (: , 3) = table (: , 3)* -1
table (: , 2) = 0
table(3, :) = table(3, :) * [10 20 30]

table = [1 2 3 ; 4 5 6]
table(3 , :) = [7 8 9]

New CODE:
clc; clear;
%given a 2d matrix from the user, delete any rows with a 0
matrix = input('Enter your 2D matrix: ');
%set a for loop up and get size of matrix
[rows,cols] = size(matrix);
for ii = rows:-1:1
for jj = 1:1:cols
if matrix(ii , jj) == 0
matrix (ii , :) = []; <---makes go away
break;
end
end
end
%Display new matrix
disp(matrix)

enter: [5 7 8; 0 1 4; 3 4 5]
**run**
crashes ---> exceeded matrix dimensions
FIX by counting backwards (change 1:1:rows to rows:-1:1)

**MATRIX TIPS**
table = randi (100, 6, 6)
random table #'s 1-100 with 6 rows and 6 columns
table = randi [50 100], 6, 6)---> makes #'s 50-100
table(2 : 5 , 2 : 5)=0 ---> makes rows 2-5 and cols 2-5 all = 0
table(2 : end-1 , 2 : end -1) = 0

**INTRO for Thurs.**
Matlab solves word search puzzles for us

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.