Skip to content

Commit 5241e11

Browse files
committed
added matlab figures
1 parent 2b222bd commit 5241e11

6 files changed

+44
-5
lines changed

img/matlab-figure-4.png

19.8 KB
Loading

img/matlab-figure-4png

19.8 KB
Binary file not shown.

img/matlab-help.png

74.9 KB
Loading

matlab.md

+5
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ legend([h1 h2],{'x^2','x^3'},'Location','northwest');
261261
set(gca,'FontSize',16);
262262
```
263263

264+
265+
![Matlab figure 4](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/matlab-figure-4.png "Matlab figure 4")
266+
264267
Large amounts of numeric data are not suited for storage in a cell array. Instead, they should be stored in a regular array. When dealing with a range of datatypes, such as patient metadata which contains text (ID, status, disease, etc) and numeric values (weight, height, age, etc) then cell arrays are ideally suited.
265268

266269
### Halting execution
@@ -280,6 +283,8 @@ The documentation for a particular function can be displayed in the Matlab comma
280283
help str2num
281284
```
282285

286+
![Matlab figure 5](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/matlab-help.png "Matlab help")
287+
283288
Alternatively, there is an interactive documentation browser which can be accessed by typing either:
284289

285290
```

programming-fundamentals.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ In the introduction below, the syntax is python.
66
## Commands
77
Python, Matlab, and R are interpreted languages. That means the code is interpreted at run time (there's no pre-compiling).
88
Commands are given to the interpreter, either as a 'script', or in an interactive session.
9-
The interpreter 'interprets' the code, translate it to binary CPU instructions,
10-
executes these instructions, and returns the result (if any).
9+
The interpreter 'interprets' the code, translate it to binary CPU instructions, executes these instructions, and returns the result (if any).
1110

1211
## Variables & Datatypes
1312
During execution, the instructions often need to access and manipulate data stored in memory.
@@ -215,7 +214,12 @@ This is a way of grouping functions and variables of similar entities together i
215214
The definition of an object is a Class, and the instance of that Class is an object.
216215
An objects functions are known as 'methods' and the variables are known as 'properties'.
217216

218-
## Accessing data
217+
## Control characters
218+
Different languages use different 'control characters' for defining seperate regions of executable code.
219+
In Matlab and R, some control characters used are the
220+
`{}()[]`. In Python, indentation is used to specify control characters.
221+
222+
## Accessing data from disk
219223
Persistent data is data which when your program finishes (or crashes), still exists on disk.
220224
Persistent data can be read and written from various sources, including simple flat text files,
221225
including CSVs, XML or json, or more complex sources such as relational databases or online APIs.
@@ -231,7 +235,7 @@ import csv
231235
with open('eggs.csv') as csvfile:
232236
spamreader = csv.reader(csvfile)
233237
for row in spamreader:
234-
print(', '.join(row))
238+
print(', '.join(row))
235239
236240
# > Spam, Spam, Spam, Spam, Spam, Baked Beans
237241
# Spam, Lovely Spam, Wonderful Spam

python.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,37 @@
99
Compared to Matlab and R, Python is fairly complicated to install and use, as it is general-purpose programming language.
1010
The situation is made more complicated by different versions (2.x vs 3.x), and different package managers.
1111

12-
### Virtualenv
12+
Generally use python3.x for new projects, and only use python2.7 if a project you are using does not support Python3.
13+
14+
### Windows installation
15+
- See Conda below
16+
17+
### Mac installation
18+
- Install [Homebrew](https://brew.sh/)
19+
Install python3 via homebrew:
20+
```
21+
# bash mac
22+
23+
brew install python
24+
```
25+
26+
### Linux installation
27+
Use the system package management system, ie aptitude or yum.
28+
29+
```
30+
# bash ubuntu
31+
32+
sudo apt-get install python3-dev python3-setuptools
33+
```
34+
35+
```
36+
# bash centos
37+
38+
sudo yum -y install python36u python36u-pip python36u-devel
39+
```
40+
41+
42+
### Virtualenv (Mac/Linux)
1343

1444
Virtualenv is the recommended approach to handling multiple installations of python on your system. Each python script or tool you use may require different versions of python, or different packages, or different versions of packages. Virtualenv is a way of seperating out these differences to resolve conflicts. Typically you would use a different virtual environment for each project you use. The following bash shell commands create a new virtual environment and then activate it for dynamic usage - all python commands entered after activate has run will use the python kernel from the virtual environment.
1545

0 commit comments

Comments
 (0)