English 中文(简体)
找到每个100个床位的最大浏览量
原标题:find out the maximum row from each 100 iteration in matlab
  • 时间:2011-07-13 07:42:50
  •  标签:
  • matlab

i) 编制一个文件:

S = load abc.mat

S = data1: [81x30 double]
    data2: [59x28 double]
    data3: [20x28 double]

在装上了这一垫子后,即使用该垫子文件操作一些代码,结果显示如下:

disp([Ball Trial A B C D])

30.0000    1.0000    0.4498    0.3652    0.4601    0.3777

30.0000    2.0000    0.5745    0.5006    0.5671    0.4940

...

30.0000   99.0000    0.5209    0.4420    0.5112    0.4311

30.0000  100.0000    0.4078    0.4142    0.3974    0.4060

35.0000    1.0000    0.4303    0.3563    0.4083    0.3356

35.0000    2.0000    0.5239    0.4469    0.5174    0.4396

...

35.0000   99.0000    0.6009    0.5442    0.5985    0.5410

35.0000  100.0000    0.5327    0.4756    0.5037    0.4503

...

100.0000   99.0000    0.3015    0.3273    0.3027    0.3287

100.0000  100.0000    0.4416    0.3960    0.4533    0.4088

气球从30球到100球(30:5:100),第2栏为100轮,第3、4、5和6栏为A、B、C、D、D和A。

[c t] = max(max(C. ));% variable c is the max of C in each ball (index) t.

i) 拟出一条线图,其中每一指数(球)中都包含最大等级。

and also display out the row of maximum c on each index (ball) in a .txt file...

结果:f.txt

30.000 23.000 0.23 0.45 0.76 0.32

35.000 19.000 0.43 0.67 0.23 0.54

...

100.000 43.000 0.54 0.11 0.54 0.99

是否有任何人能够帮助我绘制图表,获得 de? ......

最佳回答

http://www.mathwork.com/help/techdoc/ref/accumarray.html” rel=“nofollow”

%# data is the content of abc.mat
load( abc.mat )

%# find x, corresponding indices into y
[x,~,yIdx] = unique(data(:,1));

%# in each column, collect the maximum for each yIdx
y = zeros(length(x),4);
for col=1:4
    y(:,col) = accumarray(yIdx,data(:,col+2),[],@max);
end

%# plot
ph=plot(x,y);
set(ph,{ DisplayName },{ A ; B ; C ; D })
legend()

%# save result to file
dlmwrite( def.txt , [x y])
问题回答

暂无回答




相关问题
MATLAB Solving equations problem

I want to solve these equations using MATLAB and I am sure there is a non zero solution. The equations are: 0.7071*x + 0.7071*z = x -0.5*x + 0.7071*y + 0.5*z = y -0.5*x - 0.7071*y +...

Difference between MATLAB s matrix notations

How do you read the following MATLAB codes? #1 K>> [p,d]=eig(A) // Not sure about the syntax. p = 0.5257 -0.8507 -0.8507 -0.5257 d = ...

preventing data from being freed when vector goes out of scope

Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes ...

Divide two polynomials using MATLAB

I want to divide p(x) by q(x) given that: p(x)=-5x^4+3x^2-6x q(x)=x^2+1 I tried: p=inline( -5*(x^4)+3*(x^2) , x ) p = Inline function: p(x) = -5*(x^4)+3*(x^2) q=inline( x^2+1 , x ) q = ...

matlab deals with Fibbonacci

The Fibonacci series is given as follows: 1, 2, 3, 5, 8, 13, 21, ... How can I write a script which calculates and prints the n-th Fibonacci term (for n>2), where n is inputed by the user. This ...

How do I plot lines between all points in a vector?

I have a vector containing some points in 2-D space. I want MATLAB to plot these points with lines drawn from every point to every other point. Basically, I want a graph with all vertices connected. ...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen( c:\out.txt , wt ); %write something to the file fclose(fid); end I want data to be written to different files like ...

热门标签