first, let's talk . MarkDown Editor, I feel it is very convenient, because used to LaTeX , for MarkDown It 's easier to get started, but I've found that MarkDown There are several problems that have not been able to find a specific solution:
- the picture size problem. In LaTeX We can adjust the size of the image to fit the entire text;
- font, font size setting. MarkDown inside the title is quite big, but the text is too small, not very like the inside of the font.
The main findings of the above two problems lead to the edited text is very ugly.
First,Matfile
mat data format is matlab the standard format for data storage of matlab load () function Import a mat file, using the save () mat file. For file
Load (' Data.mat ')
Save (' Data_1.mat ', ' A ')
among them, ' A ' represents the content to be saved.
Second, Read the mat file in Python
in the python can be used in Scipy.io the functions in Loadmat () Read Mat files, Functions Savemat Save the file.
1. Read the file
As in the above example:
#coding: UTF-8 "Created on May 12, 2015 @author:zhaozhiyong" "Import scipy.io as Sciodatafile = ' e://data.mat ' data = Scio.loadmat (datafile)
Note that the data Read is in the dictionary format and can be viewed through the function type (data) .
Print type (data)
results show
<type ' Dict ' >
Locate The matrix in the mat file:
Print data[' A ']
results show
[0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0 ....... 0.0. 0.0. 0.0. 0.0.36470588 0.90196078 0.99215686 0.99607843 0.99215686 0.99215686 0.78431373 0.0627451 0. 0.0. 0.0. 0.0. 0.0. 0.0. 0 ........ 0.94117647 0.22745098 0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0.30196078 ..... 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. 0.0. ]]
The format is:
<type ' Numpy.ndarray ' >
is the matrix format in NumPy.
2. Save the file
will be here the data[' A '] The matrix is re-saved to a new file Datanew.mat Medium:
datanew = ' E://datanew.mat '
Scio.savemat (datanew, {' A ':d ata[' a ']})
Note: It is saved in the form of a dictionary.
Python read file--python read and save Mat file