I have a matrix with three columns
https://www.dropbox.com/s/jckdmg1p05v8lv7/y.mat?dl=0
i.e.
E1 E2 W
6 1464 0.36
6 1534 0.27
6 1585 0.27
8 1331 0.332
11 445 0.39
13 844 0.286
14 12 0.126
18 952 0.31
19 2376 0.32
20 394 0.22
20 399 0.22
20 589 0.22
21 321 0.22
21 1187 0.22
21 2509 0.22
22 1187 0.22
23 2235 0.22
24 2376 0.22
25 541 0.14
26 229 0.22
26 321 0.22
26 1187 0.22
26 2054 0.22
27 394 0.53
27 541 0.31
28 394 0.22
28 781 0.22
I used this condition
for k=1:size(y,1)
G(y(k,1),y(k,2))=true;
G(y(k,2),y(k,1))=true;
end
B=cellfun(#(x1) find(x1),num2cell(G,2),'un',0);
to extract links information like this:
1 394
2 2378
3 282
4 282
5 536
6 [1464,1534,1585]
7 2087
8 [394,399,1331]
9 1187
I need a third column contains the weight
e.i. {6,[1464,1534,1585],[0.36;0.27;0.27]}
I tried to use the above condition but I did not get the right values. Does anyone have idea how to do that ??
this is a possible soultion using accumarray:
a=[...
6 1464 0.36
6 1534 0.27
6 1585 0.27
8 1331 0.332
11 445 0.39
13 844 0.286
14 12 0.126
18 952 0.31
19 2376 0.32
20 394 0.22
20 399 0.22
20 589 0.22
21 321 0.22
21 1187 0.22
21 2509 0.22
22 1187 0.22
23 2235 0.22
24 2376 0.22
25 541 0.14
26 229 0.22
26 321 0.22
26 1187 0.22
26 2054 0.22
27 394 0.53
27 541 0.31
28 394 0.22
28 781 0.22];
% concatenate a with its copy, columns 1 and 2 swapped regarding symmetric relations
a = [a ; [fliplr(a(: , 1:2)) , a(: , 3) ]];
%create proper increasing indices for use in accumarray
[S SI] = sort(a(:,1));
S2=[0; (cumsum(diff(S)>0))];
idx = a(:,1);
idx(SI) = S2+1;
%gather elemets for each category
c1=accumarray([idx],a(:,1),[],#(x) {x(1)});
c2=accumarray([idx],a(:,2),[],#(x) {x});
c3=accumarray([idx],a(:,3),[],#(x) {x});
%concatenate columns
out=([c1 c2 c3]);
% your example
out(1,:)
This is my cross-tab crystal report for sales per week.
In last column I need the "Change" column at last in which ((21-Jun's value - 14-Jun's value)/14-Jun's value)*100 will be shown.
But I am not be able to achieve that in crystal report.
**Product Customer 31-May 7-Jun 14-Jun 21-Jun**
J.B. Officeprint 1111 Maxi-Teq 4.00 1.00 1.00 1.00
Microchips 1.00 1.00 0.00 0.00
Parameter 2.00 1.00 0.00 0.00
Total 7.00 3.00 1.00 1.00
J.B. Officeprint 1420 Maxi-Teq 4.00 1.00 1.00 1.00
Microchips 1.00 1.00 0.00 1.00
Parameter 2.00 1.00 0.00 1.00
Total 7.00 3.00 1.00 3.00
Motherboard BTX Maxi-Teq 1.00 0.00 0.00 0.00
Total 1.00 0.00 0.00 0.00
Motherboard MicroATX Maxi-Teq 1.00 0.00 0.00 0.00
Total 1.00 0.00 0.00 0.00
Printer Paper A4 Parameter 0.00 0.00 1.00 0.00
Total 0.00 0.00 1.00 0.00
Printer Paper A4 White Maxi-Teq 0.00 0.00 0.00 12.00
Microchips 0.00 0.00 30.00 0.00
Parameter 0.00 0.00 6.00 0.00
Total 0.00 0.00 36.00 12.00
Grand Total 16.00 6.00 39.00 16.00
you can do it using calculated member.
go to the preview and right click on 21-June column and go to calculated member and insert column
Edit..................................................................
Go to edit calculation formula and write your code.
Recently I needed to speed up a legacy project(use zend framework 1.10.2),that project use zend_cache,I am new in zend framework.
the default.ini configure:
data.cache.interim.frontend.name = "Core"
data.cache.interim.frontend.options.lifetime = 311040000 ; 10 years
data.cache.interim.backend.name = "File"
data.cache.interim.backend.options.cache_dir = "/cache/dp-interim/"
data.cache.interim.backend.options.hashed_directory_level = 3
There have 506790 cache files in /cache/dp-interim (run command: ls -lR | grep "^-" | wc -l on /cache/dp-interim get the result).
run "iotop",get the result: TOTAL DISK READ : 1034.22K/s
run "iostat",the result:
avg-cpu: %user %nice %system %iowait %steal %idle
1.80 0.00 0.77 51.80 0.00 45.62
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 48.00 0.00 245.00 0.00 2344.00 0.00 9.57 1.51 6.16 3.95 96.80
xvdap3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdf 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
avg-cpu: %user %nice %system %iowait %steal %idle
2.05 0.00 1.03 45.90 0.00 51.03
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 43.00 0.00 214.00 0.00 2056.00 0.00 9.61 1.10 5.20 4.47 95.60
xvdap3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdf 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
avg-cpu: %user %nice %system %iowait %steal %idle
2.06 0.00 0.26 46.91 0.00 50.77
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 62.00 0.00 196.00 0.00 2064.00 0.00 10.53 1.64 8.33 5.06 99.20
xvdap3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdf 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
qavg-cpu: %user %nice %system %iowait %steal %idle
2.33 0.00 2.59 45.34 0.00 49.74
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 33.00 0.00 331.00 0.00 2912.00 0.00 8.80 0.99 3.01 2.68 88.80
xvdap3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdf 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
It is the larger cache file cause the IO height?
Thanks for you help!
I'm very new to matlab and am more of an ArcGIS user but I'd like to know how I can read asc files into Matlab and read coordinates.
The asc file is as follows (sorry it is huge!)
ncols 32
nrows 32
xllcenter -58.75
yllcenter -38.75
cellsize 2.5
NODATA_value -999
0.00 0.62 0.60 0.38 1.22
0.52 1.09 0.76 0.00 0.94
0.37 0.52 0.71 0.71 1.38
0.13 0.00 0.00 0.00 1.46
0.00 0.00 0.97 0.00 0.41
0.00 0.00 0.41 0.83 0.00
0.00 0.19 0.32 0.00 0.00
0.00 0.86 0.00 0.52 1.34
0.00 1.29 0.00 0.00 1.40
0.83 0.00 0.00 0.00 0.00
0.00 0.00 1.09 0.20 0.00
0.43 0.00 0.96 0.78 0.26
0.00 0.70 0.00 0.92 0.29
0.00 1.19 0.00 1.24 0.73
0.00 1.41 0.00 0.97 1.01
0.66 0.00 0.01 0.67 0.67
0.32 0.69 1.41 0.00 0.08
0.92 0.00 0.00 0.40 0.00
0.00 0.00 0.00 1.27 1.24
0.22 0.00 0.00 0.76 0.86
0.00 0.05 0.67 0.29 0.00
0.00 0.04 0.00 0.00 1.18
0.46 0.20 0.00 0.81 0.00
0.00 0.00 1.35 0.40 1.03
0.94 0.90 0.80 0.26 0.73
0.69 0.36 0.70 0.00 0.00
0.42 1.23 0.00 1.24 0.52
0.00 0.54 1.39 1.44 0.00
1.18 0.10 0.00 0.00 0.78
1.33 0.58 0.00 0.00 0.00
0.00 0.92 0.00 0.00 0.00
1.03 0.00 0.00 0.00 0.00
0.66 0.92 0.73 0.00 0.99
0.00 0.00 1.39 0.49 0.97
0.00 1.29 0.00 1.41 1.06
0.00 1.00 0.00 0.00 0.00
0.00 0.32 0.69 1.26 0.00
0.00 0.71 0.00 1.08 1.16
0.00 0.00 0.48 0.00 1.17
0.24 0.00 0.00 0.41 0.00
1.24 1.30 0.00 0.00 0.00
0.00 1.23 0.00 0.15 0.00
0.00 0.19 0.00 0.00 1.17
1.41 0.00 0.15 0.48 0.20
1.29 0.00 0.22 0.55 0.00
0.00 0.81 0.00 0.00 0.00
0.00 1.18 1.18 0.00 0.75
1.05 1.18 1.35 0.00 0.82
0.00 0.00 0.25 0.52 0.00
0.00 1.27 1.46 0.00 1.24
0.00 1.03 1.21 0.81 0.00
0.57 0.00 0.00 0.00 0.00
1.06 0.00 1.29 0.70 0.00
0.00 1.01 0.00 0.00 0.00
0.21 0.95 0.00 0.00 0.00
1.23 1.08 0.00 0.00 0.00
0.11 0.00 0.00 0.00 0.00
0.00 0.00 0.76 0.00 0.68
0.10 0.64 0.00 0.72 0.00
1.34 0.53 0.00 0.18 0.00
0.00 0.25 0.22 0.00 0.00
0.00 0.67 0.37 0.00 0.08
0.02 0.00 0.00 0.94 0.52
0.83 0.64 0.00 0.93 1.40
1.03 0.50 0.00 1.20 0.00
0.68 0.00 0.00 1.15 1.20
0.00 0.00 0.00 0.93 0.00
1.25 0.94 1.37 0.00 0.00
0.00 0.77 0.00 1.15 0.66
0.00 1.45 0.00 1.48 0.00
0.36 0.00 0.34 0.00 0.00
1.22 0.74 0.00 0.00 1.17
0.00 0.59 0.00 0.00 1.18
1.32 1.31 1.21 0.45 1.06
0.00 0.18 0.21 0.79 0.47
0.00 0.47 0.00 0.53 0.76
0.00 0.92 0.00 0.00 1.23
1.45 0.00 0.00 0.00 0.00
1.02 0.00 0.00 0.46 0.00
0.00 0.00 0.00 0.38 1.25
0.00 1.25 0.00 0.42 0.17
0.00 0.97 0.20 0.00 0.00
0.31 0.20 0.00 0.00 0.00
0.00 0.70 0.66 0.00 1.15
0.00 0.00 0.91 1.10 0.00
0.12 0.73 0.00 0.19 0.00
1.01 0.00 0.44 0.00 0.21
0.00 0.00 0.00 0.00 0.91
0.01 0.00 1.28 0.00 0.00
0.00 0.16 0.50 0.00 0.00
1.50 0.10 0.00 0.00 0.00
0.07 0.07 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.88
0.00 0.43 0.00 0.00 0.00
0.00 1.23 0.00 1.41 0.33
0.00 0.74 0.00 0.00 0.00
0.74 0.76 0.15 1.07 0.00
0.00 0.00 0.00 1.34 1.20
0.00 0.00 0.00 0.00 0.43
0.22 0.00 1.02 0.99 0.80
0.91 0.75 0.02 0.00 0.18
0.25 0.00 0.52 0.60 0.00
1.11 0.43 0.00 0.00 0.83
1.02 0.76 0.20 0.00 1.24
0.00 0.00 0.00 1.21 0.00
0.00 0.00 0.00 0.00 0.25
0.00 0.00 0.00 0.00 0.87
0.00 0.00 0.00 1.47 1.22
0.86 0.00 0.96 0.60 0.70
0.38 0.09 0.85 1.18 0.49
0.03 0.00 0.00 1.23 0.00
0.00 0.00 0.00 1.06 0.00
1.01 1.39 1.01 0.00 0.00
0.00 0.00 0.00 0.00 1.31
0.00 0.75 0.00 1.22 0.81
1.07 0.00 0.00 0.00 1.12
1.05 0.70 0.13 0.64 1.30
0.00 0.00 0.53 0.47 0.03
0.00 0.00 0.10 1.38 1.32
0.00 1.25 0.00 0.91 0.67
0.00 0.00 0.00 0.00 0.00
1.00 1.14 0.00 0.00 0.52
0.00 0.02 0.15 0.01 0.90
0.00 0.00 0.70 0.00 0.00
0.00 0.00 0.00 0.00 0.00
0.12 0.72 0.00 0.00 0.04
0.01 0.00 0.00 1.11 1.43
0.91 0.34 0.97 0.00 0.07
0.00 0.00 0.00 0.00 0.93
0.00 0.93 0.00 0.00 0.00
0.93 0.00 0.88 0.29 0.00
0.00 1.50 0.00 0.05 0.00
0.00 0.00 0.00 0.76 1.26
0.00 0.43 0.55 0.40 0.28
0.00 0.07 0.51 0.51 0.00
0.76 0.00 0.00 0.41 0.10
1.16 0.07 0.00 0.00 0.65
0.00 0.21 0.00 0.00 1.41
0.00 1.31 0.19 1.44 0.00
0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.94 0.00
1.12 0.68 0.00 0.00 0.81
0.00 0.00 0.00 0.96 0.00
0.38 0.00 0.00 0.46 0.00
1.15 0.36 0.70 1.04 0.89
1.47 1.20 0.00 0.35 0.00
0.49 0.00 0.00 1.48 0.00
0.00 0.45 1.42 0.00 1.12
0.00 0.00 1.20 1.27 0.00
0.00 0.68 0.30 0.00 0.00
1.20 0.00 0.89 0.00 0.00
0.00 0.00 0.00 0.00 0.00
0.00 1.10 0.48 1.48 0.00
1.23 0.00 1.05 0.56 0.86
0.00 0.00 0.15 0.00 0.03
0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.03 0.90 0.00
0.00 0.00 1.10 0.11 0.68
0.07 0.00 0.78 1.28 1.06
0.39 0.46 0.26 0.00 0.00
0.00 0.85 0.00 0.81 0.00
0.04 0.86 0.00 0.00 0.00
0.00 0.00 0.00 1.45 0.00
0.00 0.00 0.15 0.00 0.00
0.50 0.60 0.00 1.33 0.00
1.15 0.00 1.44 0.82 0.00
0.00 0.01 0.65 0.30 0.00
0.03 0.76 1.12 0.00 0.00
0.59 0.00 0.14 1.16 0.75
0.00 0.00 0.00 0.00 0.00
0.00 1.24 0.41 0.54 1.36
0.00 0.06 0.00 0.00 0.00
0.00 0.76 0.18 1.00 0.00
0.00 0.00 0.00 1.08 0.00
0.00 0.34 0.00 0.82 0.00
0.54 0.00 0.55 0.00 0.97
1.29 0.22 0.00 0.07 0.00
1.31 1.43 0.00 0.35 1.37
0.81 0.00 0.25 0.00 0.90
0.57 0.58 0.00 0.47 0.00
0.51 0.00 0.00 0.50 0.00
0.00 0.00 0.00 1.21 0.23
0.00 0.00 0.00 0.11 0.00
1.08 1.04 0.72 0.00 0.00
0.00 0.00 0.15 0.00 0.80
0.00 0.60 0.00 0.00 1.02
0.00 1.27 0.38 0.69 0.00
1.23 0.00 0.68 0.00 0.31
0.00 0.95 0.00 0.09 0.00
0.00 0.28 0.00 0.00 0.45
0.67 0.92 0.53 1.28 0.13
0.00 0.00 1.02 0.51 0.00
0.00 0.18 0.00 0.00 0.00
0.00 0.00 0.31 0.00 0.98
0.00 0.00 0.00 1.15 0.89
0.00 0.00 0.00 0.42 0.00
1.31 1.27 0.00 0.00 0.00
0.00 0.00 1.23 1.13 0.00
1.05 0.00 0.38 0.00 0.00
0.02 0.00 0.14 0.33 0.12
0.00 0.00 0.00 0.00 0.00
0.00 0.00 1.35 0.18 0.03
0.00 0.00 0.44 0.00 0.00
0.00 1.31 0.19 0.78 0.00
1.17 0.03 1.00 1.02 0.72
nrows and ncols are the number of rows/columns
xllcenter and yllcenter are the coordinates of the centre of the square in the bottom left hand corner of the grid
the cell size is the length of one side of a grid square.
I can read the matrix in and choose to print out values according to their position in the matrix but how would I assign coordinates to such a matrix?
Can I then ask matlab to output the appropriate matrix values when I put in coordinates?
Thanks everyone who can offer me advice!
Since you are a beginner with Matlab, I suggest you investigate the menu option File | Import Data and then study the documentation of the uiimport function.
I have lines as this
ATOM 21001 O WAT 345 7.556 35.954 37.464 0.00 0.00
ATOM 21002 H1 WAT 345 7.076 35.701 36.675 0.00 0.00
ATOM 21003 H2 WAT 345 7.155 35.440 38.164 0.00 0.00
TER 0 0 0.000 0.000 0.000 0.00 0.00
ATOM 21004 O WAT 346 1.183 42.629 26.928 0.00 0.00
ATOM 21005 H1 WAT 346 1.412 43.325 26.313 0.00 0.00
ATOM 21006 H2 WAT 346 1.454 41.823 26.490 0.00 0.00
TER 0 0 0.000 0.000 0.000 0.00 0.00
ATOM 21007 O WAT 347 7.166 53.716 22.860 0.00 0.00
ATOM 21008 H1 WAT 347 7.950 54.234 22.675 0.00 0.00
ATOM 21009 H2 WAT 347 6.855 54.045 23.704 0.00 0.00
TER 0 0 0.000 0.000 0.000 0.00 0.00
ATOM 21010 O WAT 348 9.342 45.695 11.193 0.00 0.00
ATOM 21011 H1 WAT 348 8.488 45.846 10.788 0.00 0.00
ATOM 21012 H2 WAT 348 9.973 45.870 10.494 0.00 0.00
TER 0 0 0.000 0.000 0.000 0.00 0.00
ATOM 21013 O WAT 349 18.303 47.277 18.814 0.00 0.00
ATOM 21014 H1 WAT 349 17.411 47.357 18.476 0.00 0.00
ATOM 21015 H2 WAT 349 18.862 47.407 18.047 0.00 0.00
I want to delete all the characters in line contains TER except the TER word.
I have searched Internet for sed command which can do this but i can not find one which matching specific word.
Could anyone help?
You need to use the following:
sed 's/^TER.*$/TER/'