我們經(jīng)常會(huì)遇到如圖中的多個(gè)相似名稱的多個(gè)文件鬼佣,如何將這多個(gè)文件中的數(shù)據(jù)提取到同一個(gè)文件中驶拱,方便數(shù)據(jù)分析呢?
- matlab代碼如下:
for i=0:20; %定義需要提取的文件數(shù)目
filename=strcat('no_1m.',num2str(i),'.csv'); %用i把文件名稱相連
fid=csvread(filename,1,9,[1,9,1,9]); %定位需要提取的數(shù)據(jù)在文件中的坐標(biāo)
M=fid/1000000; %對(duì)提取的數(shù)據(jù)進(jìn)行操作
dlmwrite('without spray Uy.csv',M,'-append','precision',10); % 對(duì)提取的數(shù)據(jù)寫入一個(gè)新的文件中
end
-
關(guān)于matlab中的
csvread
命令:
下面是一個(gè)csv文件中的內(nèi)容,名稱為csvlist
:
02, 04, 06, 08, 10, 12
03, 06, 09, 12, 15, 18
05, 10, 15, 20, 25, 30
07, 14, 21, 28, 35, 42
11, 22, 33, 44, 55, 66
- 讀取整個(gè)數(shù)據(jù)集
m=csvread('csvlist.dat')
m =
2 4 6 8 10 12
3 6 9 12 15 18
5 10 15 20 25 30
7 14 21 28 35 42
11 22 33 44 55 66
- 從第3行晶衷,第1列開始讀
m = csvread('csvlist.dat', 2, 0)
m =
5 10 15 20 25 30
7 14 21 28 35 42
11 22 33 44 55 66
- 讀取一個(gè)區(qū)域
m = csvread('csvlist.dat', 2, 0, [2,0,3,3])
m =
5 10 15 20
MATLAB畫函數(shù)圖
%論文14拖曳系數(shù)圖蓝纲,圖1,圖2
ezplot('y1-0.16./[log(5302.7./x.^2)].^2=0',[0 4 10^-3 5*10^-3]);
hold on
ezplot('y2-((1-5.167*10^-2*x^2)*0.16./[log(5302.7./x.^2)].^2)=0',[0 4 10^-3 5*10^-3]);
grid on+
MATLAB設(shè)置圖片大小
clear;
hold on;
x1=[27.3,33.1,40.8,50.8];
y1=[0.00193,0.00197,0.00193,0.00148];
scatter(x1,y1,'k');
hold on;
x2=[27.3,33.0,40.9,50.8];
y2=[0.00196,0.00215,0.00186,0.00150];
scatter(x2,y2,'+');
hold on;
x3=[27.9,32.7,39.7,49.8];
y3=[0.00146,0.00223,0.00260,0.00189];
scatter(x3,y3,'x');
hold on;
x4=[27.6,32.5,40.3,50.1];
y4=[0.00178,0.00244,0.00216,0.00173];
scatter(x4,y4,'d');
scatter(x1,y1,'k');
hold on;
scatter(x2,y2,'+');
hold on;
scatter(x3,y3,'x');
hold on;
scatter(x4,y4,'d');
set (gcf,'Position',[100,100,320,256]);%設(shè)置輸出圖片大小
set (gcf,'Position',[100,100,500,400]);