Variables & Arithmetic Flashcards

(14 cards)

1
Q

Clear command window

A

clc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Clear variables in workspace

A

clearvars

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Assigning values to variables

A

Variable = value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do we see all variables and their values?

A

Whos

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do we get strings?

A

Using quotation marks

w = “string”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do we use for not showing results in command windows?

A

Use semicolon for not showing the output of a line.

x = 10 + 9 ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do we use for assigning multiple things in one line?

A

Use commas for using several variables in one line:

U = 20 , Me = 20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we run programs quickly?

A

Ctrl + Enter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we add comments?

A

Using percentage sign

% This is a comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to check the type of data of a variable?

A

By using the function “class”. This is how:

class(variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to create structures like objects in python?

A

An example would be:

my_struct.name = “Aldair”
my_struct.age = 30
my_struct.gender = “male”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Some built in functions for structures?

A

isfield(my_struct, field)

rmfield(my_struc, field)

setfield(my_struct, field)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Can I set structures within structures?

A

Yes, like this (example)

my_struct.contact.phone
my_struct.contact.email

I created a field contact that is itself a structure that has two fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Manually creating a structure?

A

my_struct = struct(field1, value1, field2, value2,…, field_n, value_n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly