爱情 (1) 安装 (2) 北斗 (1) 毕业 (1) 变量 (1) 测绘局 (1) 测量 (2) 插件 (1) 查询 (1) 常用 (1) 成果转化 (1) 词汇 (1) 慈善 (1) 答辩 (2) 代码 (2) 电台 (1) 发泄 (1) 感悟 (4) 高程 (1) 搞笑 (5) 共产党 (1) 古诗词 (1) 管理 (1) 函数 (3) 绘图 (1) 加密 (1) 交际 (1) 教程 (4) 教育 (2) 解决 (4) 解密 (1) 精度 (1) 酒桌 (2) 开源 (2) 科技 (1) 科学 (1) 刻录 (1) 老外 (1) 励志 (5) 连续剧 (1) 恋爱 (1) 列表 (1) 领导 (1) 美食 (2) 名人 (3) 命令 (4) 区别 (1) 日记 (2) 软件 (12) 商业 (3) 时政 (1) 视频 (1) 数据 (1) 算法 (1) 投影 (2) 图论 (1) 网络 (1) 网站 (1) 卫星 (3) 未成年 (1) 慰问 (1) 文本 (1) 文件 (2) 下载 (4) 笑话 (2) 学习 (9) 遥感 (1) 疑问 (5) 营销 (1) 娱乐 (3) 源代码 (2) 政策 (1) 指导 (3) 智慧 (5) 主成分分析 (2) 抓图 (1) 专家 (1) 资料 (5) 字符串 (1) 最短路径 (1) 坐标 (1) baidu (3) Bernese (1) blog (2) c# (9) China (3) Dijkstra (1) DNS (1) doris (1) dos (1) excel (1) firefox (3) GAMIT (8) gcc (1) GIS (3) GMT (1) GPS (5) ITRF (1) linux (5) mapx (1) matlab (6) movie (4) music (3) oracle (2) pic (1) PPT (3) PROJ.4 (2) python (2) QQ (2) rinex (1) shell (2) sql (1) teqc (3) tools (1) tps (1) ubuntu (5) USA (1) website (1)

2010年4月11日星期日

250部高票选电影

http://www.imdb.com/chart/top

Top 250 movies as voted by our users
For this top 250, only votes from regular voters are considered.


Rank Rating Title Votes
1. 9.1 The Shawshank Redemption (1994) 486,048
2. 9.1 The Godfather (1972) 390,338
3. 9.0 The Godfather: Part II (1974) 230,925
4. 8.9 Il buono, il brutto, il cattivo. (1966) 147,859
5. 8.9 Pulp Fiction (1994) 394,568
6. 8.9 Schindler's List (1993) 261,136
7. 8.8 12 Angry Men (1957) 108,946
8. 8.8 One Flew Over the Cuckoo's Nest (1975) 201,499
9. 8.8 Star Wars: Episode V - The Empire Strikes Back(1980) 264,307
10. 8.8 The Dark Knight (2008) 433,425
11. 8.8 The Lord of the Rings: The Return of the King(2003) 345,187
12. 8.8 Star Wars (1977) 308,115
13. 8.7 Casablanca (1942) 160,523
14. 8.7 Shichinin no samurai (1954) 91,743
15. 8.7 Goodfellas (1990) 216,495
16. 8.7 Fight Club (1999) 359,688
17. 8.7 Cidade de Deus (2002) 155,789
18. 8.7 The Lord of the Rings: The Fellowship of the Ring(2001) 369,727
19. 8.7 Raiders of the Lost Ark (1981) 232,417
20. 8.7 Rear Window (1954) 112,688
21. 8.7 The Usual Suspects (1995) 254,460
22. 8.7 Psycho (1960) 135,702
23. 8.7 C'era una volta il West (1968) 69,105
24. 8.6 The Silence of the Lambs (1991) 231,985
25. 8.6 The Matrix (1999) 361,212
26. 8.6 Se7en (1995) 262,164
27. 8.6 Memento (2000) 255,709
28. 8.6 The Lord of the Rings: The Two Towers (2002) 311,152
29. 8.6 It's a Wonderful Life (1946) 97,282
30. 8.6 Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1964) 149,742
31. 8.6 Sunset Blvd. (1950) 51,433
32. 8.6 North by Northwest (1959) 88,688
33. 8.6 Citizen Kane (1941) 132,939
34. 8.6 Léon (1994) 187,596
35. 8.6 Apocalypse Now (1979) 165,409
36. 8.6 Forrest Gump (1994) 282,525
37. 8.5 American Beauty (1999) 279,108
38. 8.5 American History X (1998) 211,343
39. 8.5 Taxi Driver (1976) 146,891
40. 8.5 Vertigo (1958) 86,982
41. 8.5 Terminator 2: Judgment Day (1991) 224,519
42. 8.5 Lawrence of Arabia (1962) 76,059
43. 8.5 Alien (1979) 171,193
44. 8.5 Le fabuleux destin d'Amélie Poulain (2001) 170,759
45. 8.5 WALL·E (2008) 167,276
46. 8.5 Saving Private Ryan (1998) 257,554
47. 8.5 A Clockwork Orange (1971) 183,916
48. 8.5 The Shining (1980) 167,739
49. 8.4 Paths of Glory (1957) 42,297
50. 8.4 The Departed (2006) 247,446
51. 8.4 The Pianist (2002) 125,710
52. 8.4 To Kill a Mockingbird (1962) 78,864
53. 8.4 Aliens (1986) 162,411
54. 8.4 Sen to Chihiro no kamikakushi (2001) 94,155
55. 8.4 Das Leben der Anderen (2006) 69,278
56. 8.4 M (1931) 37,643
57. 8.4 Double Indemnity (1944) 34,996
58. 8.4 Eternal Sunshine of the Spotless Mind (2004) 207,779
59. 8.4 Chinatown (1974) 74,856
60. 8.4 Requiem for a Dream (2000) 174,773
61. 8.4 The Third Man (1949) 48,640
62. 8.4 L.A. Confidential (1997) 158,255
63. 8.4 Reservoir Dogs (1992) 202,086
64. 8.4 Das Boot (1981) 67,309
65. 8.4 The Treasure of the Sierra Madre (1948) 31,463
66. 8.4 Monty Python and the Holy Grail (1975) 148,869
67. 8.4 City Lights (1931) 25,528
68. 8.4 El laberinto del fauno (2006) 143,521
69. 8.4 The Bridge on the River Kwai (1957) 56,202
70. 8.4 Inglourious Basterds (2009) 152,899
71. 8.3 Raging Bull (1980) 85,461
72. 8.3 Avatar (2009) 219,091
73. 8.3 The Prestige (2006) 189,362
74. 8.3 Back to the Future (1985) 189,965
75. 8.3 Up (2009) 92,133
76. 8.3 2001: A Space Odyssey (1968) 153,084
77. 8.3 La vita è bella (1997) 102,064
78. 8.3 Singin' in the Rain (1952) 52,702
79. 8.3 Modern Times (1936) 33,463
80. 8.3 Der Untergang (2004) 77,410
81. 8.3 Some Like It Hot (1959) 63,914
82. 8.3 Amadeus (1984) 92,231
83. 8.3 Full Metal Jacket (1987) 143,376
84. 8.3 Nuovo cinema Paradiso (1988) 42,707
85. 8.3 The Maltese Falcon (1941) 49,227
86. 8.3 Braveheart (1995) 229,138
87. 8.3 Rashômon (1950) 36,821
88. 8.3 Gran Torino (2008) 114,433
89. 8.3 Once Upon a Time in America (1984) 68,190
90. 8.3 All About Eve (1950) 33,423
91. 8.3 Metropolis (1927) 37,186
92. 8.3 The Green Mile (1999) 186,860
93. 8.3 The Elephant Man (1980) 54,894
94. 8.3 Slumdog Millionaire (2008) 162,617
95. 8.3 Sin City (2005) 242,839
96. 8.3 The Great Dictator (1940) 34,755
97. 8.3 Rebecca (1940) 33,664
98. 8.3 The Apartment (1960) 34,413
99. 8.3 The Sting (1973) 62,647
100. 8.3 Gladiator (2000) 263,741
101. 8.3 The Great Escape (1963) 58,785
102. 8.3 Indiana Jones and the Last Crusade (1989) 163,883
103. 8.3 Star Wars: Episode VI - Return of the Jedi (1983) 201,650
104. 8.3 Ladri di biciclette (1948) 25,621
105. 8.3 Unforgiven (1992) 92,753
106. 8.3 Jaws (1975) 130,916
107. 8.3 Batman Begins (2005) 255,525
108. 8.2 Blade Runner (1982) 177,488
109. 8.2 Die Hard (1988) 172,053
110. 8.2 Hotel Rwanda (2004) 86,775
111. 8.2 Mr. Smith Goes to Washington (1939) 31,769
112. 8.2 On the Waterfront (1954) 39,125
113. 8.2 Oldboy (2003) 90,445
114. 8.2 No Country for Old Men (2007) 186,768
115. 8.2 Touch of Evil (1958) 31,071
116. 8.2 Det sjunde inseglet (1957) 34,739
117. 8.2 Fargo (1996) 158,143
118. 8.2 District 9 (2009) 132,137
119. 8.2 Mononoke-hime (1997) 61,795
120. 8.2 The Wizard of Oz (1939) 98,188
121. 8.2 Per qualche dollaro in più (1965) 40,337
122. 8.2 Heat (1995) 137,362
123. 8.2 Strangers on a Train (1951) 32,281
124. 8.2 Cool Hand Luke (1967) 43,030
125. 8.2 Donnie Darko (2001) 199,682
126. 8.2 High Noon (1952) 32,505
127. 8.2 The Sixth Sense (1999) 227,462
128. 8.2 Notorious (1946) 29,836
129. 8.2 There Will Be Blood (2007) 123,262
130. 8.2 The Deer Hunter (1978) 83,854
131. 8.2 The Manchurian Candidate (1962) 33,348
132. 8.2 Annie Hall (1977) 62,111
133. 8.2 The Wrestler (2008) 84,580
134. 8.2 Kill Bill: Vol. 1 (2003) 219,465
135. 8.2 Snatch. (2000) 163,480
136. 8.2 The General (1926) 18,776
137. 8.2 Platoon (1986) 103,294
138. 8.1 The Big Lebowski (1998) 167,881
139. 8.1 Yojimbo (1961) 27,591
140. 8.1 Ben-Hur (1959) 55,667
141. 8.1 Into the Wild (2007) 90,400
142. 8.1 Ran (1985) 32,847
143. 8.1 The Big Sleep (1946) 27,621
144. 8.1 Million Dollar Baby (2004) 132,552
145. 8.1 It Happened One Night (1934) 23,753
146. 8.1 The Lion King (1994) 126,761
147. 8.1 Life of Brian (1979) 89,334
148. 8.1 Witness for the Prosecution (1957) 16,904
149. 8.1 Butch Cassidy and the Sundance Kid (1969) 54,697
150. 8.1 The Bourne Ultimatum (2007) 136,627
151. 8.1 Smultronstället (1957) 20,035
152. 8.1 Finding Nemo (2003) 154,921
153. 8.1 Trainspotting (1996) 143,252
154. 8.1 Stand by Me (1986) 85,376
155. 8.1 Star Trek (2009) 122,069
156. 8.1 The Graduate (1967) 74,059
157. 8.1 The Terminator (1984) 170,180
158. 8.1 Toy Story (1995) 136,829
159. 8.1 Gone with the Wind (1939) 75,058
160. 8.1 Groundhog Day (1993) 127,739
161. 8.1 Scarface (1983) 143,466
162. 8.1 The Thing (1982) 73,725
163. 8.1 Amores perros (2000) 57,833
164. 8.1 Ratatouille (2007) 123,212
165. 8.1 Dog Day Afternoon (1975) 56,121
166. 8.1 Gandhi (1982) 48,020
167. 8.1 V for Vendetta (2005) 210,926
168. 8.1 The Gold Rush (1925) 19,632
169. 8.1 The Grapes of Wrath (1940) 22,160
170. 8.1 Le salaire de la peur (1953) 13,310
171. 8.1 Lock, Stock and Two Smoking Barrels (1998) 118,700
172. 8.1 Twelve Monkeys (1995) 161,321
173. 8.1 8½ (1963) 27,806
174. 8.1 Les diaboliques (1955) 13,543
175. 8.1 Casino (1995) 102,608
176. 8.1 The Night of the Hunter (1955) 24,271
177. 8.1 The Princess Bride (1987) 119,428
178. 8.0 Hotaru no haka (1988) 32,143
179. 8.0 The Incredibles (2004) 149,884
180. 8.0 Judgment at Nuremberg (1961) 13,134
181. 8.0 The Killing (1956) 23,363
182. 8.0 Kind Hearts and Coronets (1949) 12,291
183. 8.0 The Wild Bunch (1969) 29,519
184. 8.0 Children of Men (2006) 148,582
185. 8.0 In Bruges (2008) 89,269
186. 8.0 The Exorcist (1973) 97,388
187. 8.0 Sunrise: A Song of Two Humans (1927) 10,600
188. 8.0 Le notti di Cabiria (1957) 10,274
189. 8.0 The Kid (1921) 12,886
190. 8.0 The Best Years of Our Lives (1946) 16,443
191. 8.0 The Hustler (1961) 24,127
192. 8.0 Dial M for Murder (1954) 27,873
193. 8.0 Harvey (1950) 22,143
194. 8.0 Ed Wood (1994) 70,510
195. 8.0 Good Will Hunting (1997) 141,701
196. 8.0 Rosemary's Baby (1968) 47,504
197. 8.0 Big Fish (2003) 133,572
198. 8.0 King Kong (1933) 36,789
199. 8.0 Letters from Iwo Jima (2006) 52,946
200. 8.0 A Streetcar Named Desire (1951) 31,985
201. 8.0 Låt den rätte komma in (2008) 48,904
202. 8.0 Sleuth (1972) 16,339
203. 8.0 Shadow of a Doubt (1943) 20,180
204. 8.0 Stalag 17 (1953) 19,753
205. 8.0 Kill Bill: Vol. 2 (2004) 172,633
206. 8.0 Le scaphandre et le papillon (2007) 28,435
207. 8.0 Magnolia (1999) 116,755
208. 8.0 Mystic River (2003) 112,301
209. 8.0 Rocky (1976) 90,024
210. 8.0 Crash (2004/I) 162,895
211. 8.0 Brief Encounter (1945) 12,629
212. 8.0 The African Queen (1951) 32,378
213. 8.0 Network (1976) 31,551
214. 8.0 Rope (1948) 29,488
215. 8.0 Bonnie and Clyde (1967) 39,150
216. 8.0 Duck Soup (1933) 25,154
217. 8.0 Manhattan (1979) 36,559
218. 8.0 The Curious Case of Benjamin Button (2008) 126,135
219. 8.0 La strada (1954) 16,706
220. 8.0 Pirates of the Caribbean: The Curse of the Black Pearl (2003) 220,883
221. 8.0 La battaglia di Algeri (1966) 12,891
222. 8.0 Shutter Island (2010) 57,436
223. 8.0 Wo hu cang long (2000) 104,594
224. 8.0 Changeling (2008) 58,464
225. 8.0 Patton (1970) 37,721
226. 8.0 The Conversation (1974) 31,095
227. 8.0 Little Miss Sunshine (2006) 142,485
228. 8.0 Planet of the Apes (1968) 54,488
229. 8.0 The Adventures of Robin Hood (1938) 22,073
230. 8.0 Les quatre cents coups (1959) 22,292
231. 8.0 The Nightmare Before Christmas (1993) 74,009
232. 8.0 Who's Afraid of Virginia Woolf? (1966) 18,383
233. 7.9 All Quiet on the Western Front (1930) 20,199
234. 7.9 Barry Lyndon (1975) 37,693
235. 7.9 Anatomy of a Murder (1959) 15,612
236. 7.9 Mulholland Dr. (2001) 96,020
237. 7.9 Shaun of the Dead (2004) 123,937
238. 7.9 The Lady Vanishes (1938) 17,020
239. 7.9 Spartacus (1960) 48,055
240. 7.9 The Truman Show (1998) 145,204
241. 7.9 Glory (1989) 54,676
242. 7.9 Tonari no Totoro (1988) 27,547
243. 7.9 Monsters, Inc. (2001) 105,984
244. 7.9 The Philadelphia Story (1940) 26,594
245. 7.9 His Girl Friday (1940) 19,865
246. 7.9 Toy Story 2 (1999) 106,497
247. 7.9 Arsenic and Old Lace (1944) 28,461
248. 7.9 Mou gaan dou (2002) 33,608
249. 7.9 Edward Scissorhands (1990) 97,461
250. 7.9 Brazil (1985) 74,038


The formula for calculating the Top Rated 250 Titles gives a true Bayesian estimate:

weighted rating (WR) = (v ÷ (v+m)) × R + (m ÷ (v+m)) × C
where:


R = average for the movie (mean) = (Rating)
v = number of votes for the movie = (votes)
m = minimum votes required to be listed in the Top 250 (currently 3000)
C = the mean vote across the whole report (currently 6.9)

for the Top 250, only votes from regular voters are considered.

2010年4月9日星期五

与matlab软件媲美的免费Octave

http://zh.wikipedia.org/zh-cn/GNU_Octave

Octave 是一个旨在提供与Matlab语法相容的开放源码科学计算及数值分析的工具;它同时也是GNU计划成员之一。

GNU Octave


开发 John W. Eaton
最新版本 3.2.4 / 2010年1月28日
最新预览版本 3.3.50 / 2009年9月12日
操作系统 跨平台
类型 数学软件
许可协议 GNU通用公共许可证
网站 http://www.gnu.org/software/octave/


历史
该软件肇始于1988年,其初衷是提供一些化学反应设计课程的辅助工具。

系统性开发则是由John W. Eaton在1992年接手才开始的。 第一个alpha测试版是在1993年1月4日释出,1.0稳定版则是在同年2月17日释出。最新的3.2.4稳定版在2010年1月28日释出。

其名称与音乐上的八度没有直接关系。该软件乃是以一位早期开发群的成员,同时也以敏于处理数值逼近问题著称的前教授命名。

[编辑]技术细节
Octave是以C++的标准模板函式库编程而成。
Octave有自己Octave语言直译器。
Octave可以动态外挂模组扩充。
Octave的直译器可用gnuplot及Grace产生图表及打印。
[编辑]Octave语言
Octave语言是直译式及结构化(类于C语言)的编程语言,支援许多C语言的标准函式库提供的功能,同时可以使用UNIX的系统呼叫以进行扩充增进功能,但不支援以引用的方式传递参数。

Octave程式包含了许多脚本函式呼叫,它本身是以矩阵为基础并提供许多矩阵的操作函式。它并非面向对象编程语言但支援资料建构。

它的语法基本上与Matlab一致,严谨编写的程式码应同时可在Matlab及Octave执行。

由于Octave是以GNU通用公共许可证授权,所以可以自由地复制、流通与使用。Octave可在大部份的类Unix操作系统中执行,亦可在Microsoft Windows中执行。

[编辑]特殊功能
变量及函式名称自动补齐
在命令列按下TAB键,Octave会自动补齐变量,函式或档案的名称。Octave会依据光标之前的文字来补齐。

指令回溯
在互动模式下,Octave会将历次指令存在暂存盘中以俟呼叫与编辑。

资料建构
Octave包含了初步的资料建构功能,例如:

octave:1> x.a = 1; x.b = [1, 2; 3, 4];x.c = "string";
octave:2> x.a
x.a = 1
octave:3> x.b
x.b =

1 2
3 4

octave:4> x.c
x.c = string

短路逻辑算符
Octave的`&&'及`||'的逻辑算符是在短路的方式下运算(如同C语言中的相仿算符),相反于逐算子算符`&' 及`|'。

递增与递减算符
Octave如同C语言一样具有可前置或后置的递增与递减算符。

例外处理
Octave以提供初步的LISP式unwind_protect例外处理模式。通常unwind_protect的表述区段可表示如下:

unwind_protect
body
unwind_protect_cleanup
cleanup
end_unwind_protect

变量长度参数表列
Octave提供用于处理未指明参数个数时的函式呼叫机制:利用特殊的varargin作为参数来呼叫函式。

function s = plus (varargin)
if (nargin==0)
s = 0;
else
s = varargin{1} + plus (varargin{2:nargin});
endif
endfunction

变量长度回传表列
单一函式可以varargout这一特殊回传值来回传任意数目的值,例如:

function varargout = multiassign (data)
for k=1:nargout
varargout{k} = data(:,k);
endfor
endfunction

[编辑]MATLAB相容性
Octave最初便是模彷Matlab而设计,自然与Matlab有许多相同的功能。 这也使得一部分Matlab程序可以直接或经过少量修改在Octave上运行,一些软件开发小组也使用两者兼容的语法,直接开发可以同时在Matlab和Octave使用的程序。

矩阵为基础资料型别之一
内建支援复数
内建功能强大的数学函式及可扩充的函式库
使用者可自定函式

2010年4月8日星期四

matlab c# 混合编程实例---matlab帮助文档

Deploying a Component Using the Magic Square Example
On this page…

About This Example

Magic Square Example: MATLAB Programmer Tasks

Using the Command Line to Create .NET Components

Magic Square Example: .NET Programmer Tasks
About This Example

This example shows you how to transform a simple M-code function into a deployable MATLAB Builder NE component.

The Magic Square example shows you how to create a .NET component named MagicSquareComp, which contains the magic class and other files needed to deploy your application.

The magicSquareClass wraps a MATLAB function, makesquare, which computes a magic square. A magic square is a matrix containing any number of rows. These rows, added horizontally, vertically, or diagonally, equate to the same value. MATLAB contains a function, magic, that you can use to create magic squares of any dimension.

Note The examples here use the Windows deploytool GUI, a graphical front-end interface to MATLAB Compiler software. For information about how to perform these tasks using the command-line interface to MATLAB Compiler software, see the mcc reference page.

Note If you wish to create a remotable component, and for information about what this entails, see Sharing Components Across Distributed Applications Using .NET Remoting.

Back to Top of Page Back to Top
Magic Square Example: MATLAB Programmer Tasks

The MATLAB programmer usually performs the following tasks.

Key Tasks for the MATLAB Programmer
Task Reference
1. Start the product. Starting the Deployment Tool
2. Prepare to run the example by copying the MATLAB example files into a work folder. Copying the Example Files
3. Test the M-code to ensure it is suitable for deployment. Testing the M-File You Want to Deploy
4. Create a .NET component (encapsulating your M-code in a .NET class) by running the Build function in deploytool. Building Your Component
5. Prepare to run the Packaging Tool by determining what additional files to include with the deployed component. Packaging Your Component (Optional)
6. Copy the output. Copying the Package You Created

Note The MATLAB Builder NE examples are in matlabroot\toolbox\dotnetbuilder\Examples\VS8\NET. This example assumes the work folder is on drive D:.

Starting the Deployment Tool

Access the MATLAB Builder NE product through the Deployment Tool GUI (deploytool) or through the mcc function of the MATLAB Compiler product. deploytool is the GUI front end for mcc, which executes MATLAB Compiler software.

This example uses deploytool. If you want to use mcc, see the mcc reference page for complete reference information.

To start this product:

1.

Start MATLAB.
2.

Type deploytool at the MATLAB command prompt. The deploytool GUI opens.

Copying the Example Files

Prepare to run the example by copying needed files into your work area as follows:

1.

Navigate to matlabroot\toolbox\dotnetbuilder\Examples\VS8\NET\MagicSquareExample.

Tip matlabroot is the MATLAB root folder (where MATLAB is installed). To find the value of this variable on your system, type matlabroot at a MATLAB command prompt.
2.

Copy the MagicSquareExample folder to a work area, for example, D:\dotnetbuilder_examples. Avoid using spaces in your folder names, if possible.
3.

Rename the subfolder MagicSquareExample to magic_square. The example files should now reside in D:\dotnetbuilder_examples\magic_square.
4.

Using a system command prompt, navigate to D:\dotnetbuilder_examples\magic_square by switching to the D: drive and entering cd \dotnetbuilder_examples\magic_square.

Testing the M-File You Want to Deploy

In this example, you test a precreated M-file (magicsquare.m) containing the predefined MATLAB function magic, in order to have a baseline to compare to the results of the function when it is finally wrappered as a deployable .NET component.

1.

Using MATLAB, locate the magicsquare.m file at D:\dotnetbuilder_examples\magic_square\MagicDemoComp. The contents of the file are as follows:

function y = makesquare(x)
%MAKESQUARE Magic square of size x.
% Y = MAKESQUARE(X) returns a magic square of size x.
% This file is used as an example for the MATLAB
% Builder NE product.

% Copyright 2001-2009 The MathWorks, Inc.

y = magic(x);

2.

To run makesquare, ensure that MATLAB can find it. Select File > Set Path in MATLAB to add the D:\dotnetbuilder_examples\magic_square\MagicDemoComp folder to the MATLAB search path.
3.

At the MATLAB command prompt, enter makesquare(5) and view the results. The output should appear as follows:

17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

About MATLAB Function Signatures. MATLAB supports multiple signatures for function calls.

The generic MATLAB function has the following structure:

function [Out1,Out2,...,varargout]=foo(In1,In2,...,varargin)

To the left of the equal sign, the function specifies a set of explicit and optional return arguments.

To the right of the equal sign, the function lists explicit input arguments followed by one or more optional arguments.

All arguments represent a specific MATLAB type.

When the MATLAB Builder NE product processes your M-code, it creates several overloaded methods that implement the MATLAB functions. Each of these overloaded methods corresponds to a call to the generic MATLAB function with a specific number of input arguments. In addition to these methods, the builder creates another method that defines the return values of the MATLAB function as an input argument. This method simulates the feval external API interface in MATLAB.
Building Your Component

You create a .NET component by using the Deployment Tool GUI to build a .NET class that wraps around the sample M-code discussed in Testing the M-File You Want to Deploy.

Use the following information when creating your component as you work through this example:
Project Name magicSquareComp
Class Name magicSquareClass
File to compile makesquare.m

1.

Create a deployment project. A project is a collection of files you bundle together under a project file name (.prj file) for your convenience in the Deployment Tool. Using a project makes it easy for you to build and run an application many times—effectively testing it—until it is ready for deployment.
1.

Type the name of your project in the Name field.
2.

Enter the location of the project in the Location field. Alternately, navigate to the location.
3.

Select the target for the deployment project from the Target drop-down menu.
4.

Click OK.
2.

On the Build tab, add what you want to compile, and any supporting files, to the project.
1.

Do the following, depending on the type of application you are building:
*

If you are building a COM application or Microsoft® Excel® add-in, click Add files.
*

If you are building a .NET application, click Add class. Type the name of the class in the Class Name field, designated by the letter "c":

For this class, add files you want to compile by clicking Add files. To add another class, click Add class.
2.

Add any supporting files. For example, you can add the following files, as appropriate for your project:
*

Functions called using eval (or variants of eval)
*

Functions not on the MATLAB path
*

Code you want to remain private
*

Code from other programs that you want to compile and link into the main file

If you want to include additional files, in the Shared Resources and Helper Files area, click Add files/directories. Click Open to select the file or files.
3.

When you complete your changes, click the Build button ( ).

How the .NET Builder Creates a Component. To create a component, the builder does the following:

1.

Generates C# code to implement your component

The first step of the build process generates two C# files: a component data file and a component wrapper. The component data file contains static information for the component. The wrapper contains the implementation code for the .NET component and provides a .NET application programming interface (API) for the MATLAB functions you add to the project at design time.
2.

Compiles the C# code and generates /distrib and /src subfolders

The second step of the build process compiles the two C# files produced in step 1, creating a managed assembly for the component.

The MATLAB Builder NE product creates two subfolders under the project folder: project-folder/src and project-folder/distrib. These subfolders contain the following files.

Files in the Project Subfolders
Subfolder Files Description
src ComponentName
_mcc_component_data.cs C# component data file
ClassName1.cs ...
ClassNameN.cs C# wrapper class file
distrib ComponentName.dll .NET component assembly
ComponentName.pdb .NET component debug file (Debug builds only)
ComponentName.xml .NET component XML documentation file
MWArray.xml
component_name.xml
component_name_overview.html Documentation template files. See Using Enhanced XML Documentation Files.

Note When you build your project, you can specify the compilation of a private or shared assembly. A private assembly is copied to an application subfolder and is owned exclusively by the application. A shared assembly usually resides in the Global Assembly Cache, and can be directly referenced by multiple applications.

Packaging Your Component (Optional)

Bundling the .NET component with additional files you can distribute to users is called packaging. You perform this step using the packaging function of deploytool. Alternately, copy the contents of the distrib folder and the MCR Installer to a local folder of your choice. If you are creating a shared component and want to include additional code with the component, you must perform this step.

1.

On the Package tab, add the MATLAB Compiler Runtime (the MCR) by clicking Add MCR.
2.

Next, add others files useful for end users. The readme.txt file contains important information about others files useful for end users. To package additional files or folders, click Add file/directories, select the file or folder you want to package, and click Open.
3.

In the Deployment Tool, click the Packaging button ( ).
4.

After packaging, the package resides in the distrib subfolder. On Windows, the package is a self-extracting executable. On platforms other than Windows, it is a .zip file. Verify that the contents of the distrib folder contains the files you specified.

What Happens in the Packaging Process?. The package process zips the following files into a single self-extracting executable, componentName.exe:

*

componentName.dll
*

componentName.xml
*

componentName.pdb (if the Debug option is selected)
*

MCRInstaller.exe (if the Include MCR option is selected)
*

_install.bat (script run by the self-extracting executable)

How the MCR Is Shared Among Classes. The builder creates a single MCR instance for each MATLAB Builder NE class in an application. This MCR is reused and shared among all subsequent class instances within the component, resulting in more efficient memory usage and eliminating the MCR startup cost in each subsequent class instantiation. All class instances share a single MATLAB workspace and share global variables in the M-files used to build the component.

The following example creates a .NET component called mycomponent containing a single .NET class named myclass with methods foo and bar.

If and when multiple instances of myclass are instantiated in an application, only one MCR is initialized, and it is shared by all instances of myclass.

mcc -B 'dotnet:mycomponent,myclass,2.0,Private,local' foo.m bar.m

Copying the Package You Created

Copy the package that you created from the distrib folder to the local folder of your choice or send them directly to the .NET programmer.

Back to Top of Page Back to Top
Using the Command Line to Create .NET Components

Instead of using the Deployment Tool to create .NET components, you can use the mcc command.

The following sections describe the subset of mcc command options that you need to create .NET components. The sections provide detailed mcc syntax with examples.

To learn more about the mcc command and all of its options, see the MATLAB Compiler documentation.
Command-Line Syntax Description

The following command defines the complete mcc command syntax with all required and optional arguments used to create a .NET component. Brackets indicate optional parts of the syntax.

mcc - W 'dotnet:component_name,class_name, 0.0|2.0, Private|Encryption_Key_Path,local|remote' file1 [file2...fileN][class{class_name:file1 [,file2,...,fileN]},... [-d output_dir_path] -T link:lib

Note For complete information about the mcc command, including the -W option, see mcc in the function reference section of this user's guide.

Using the .NET Bundle Files to Simplify the Command

To simplify the command line used to create .NET components, you can use the .NET Builder bundle file, named dotnet, to make creating .NET components easier. When using this bundle file, you must still pass in the four parts of the -W argument text string, however, you do not have to specify the -T option.

The following example creates a .NET component called mycomponent containing a single .NET class named myclass with methods foo and bar. When used with the -B option, the word dotnet specifies the name of the predefined .NET Builder bundle file.

mcc -B 'dotnet:mycomponent,myclass,2.0,encryption_keyfile_path,local'
foo.m bar.m

In this example, the builder uses the .NET Framework version 2.0 to compile the component into a shared assembly using the key file specified in encryption_keyfile_path to sign the shared component.
Example: Creating a .NET Component Namespace

The following example creates a .NET component from two M-files foo.m and bar.m.

mcc - B 'dotnet:mycompany.mygroup.mycomponent,myclass,0.0,Private,local'
foo.m bar.m

The example creates a .NET component named mycomponent that has the following namespace: mycompany.mygroup. The component contains a single .NET class, myclass, which contains methods foo and bar.

To use myclass, place the following statement in your code:

using mycompany.mygroup;

Example: Adding Multiple Classes to a Component

The following example creates a .NET component that includes more than one class. This example uses the optional class{...} argument to the mcc command.

mcc - B 'dotnet:mycompany.mycomponent,myclass,2.0,Private,local' foo.m bar.m
class{myclass2:foo2.m,bar2.m}

The example creates a .NET component named mycomponent with two classes:

*

myclass has methods foo and bar
*

myclass2 has methods foo2 and bar2

Back to Top of Page Back to Top
Magic Square Example: .NET Programmer Tasks

The following tasks are usually performed by the .NET programmer.

Key Tasks for the .NET Programmer
Task Reference
1. Ensure you have the needed files from the MATLAB programmer before proceeding. Gathering Files Needed for Deployment
2. Use the component in a .NET application. Compile and run the component to ensure it produces the same results as your M-code. Using the Component in an Application
3. Archive and distribute the output to end users. Distributing the Component to End Users
4. Integrate classes generated by the MATLAB Builder NE product into existing .NET applications. Integrating .NET Classes Generated by MATLAB into a .NET Application
5. Verify your .NET application works as expected in your end user's deployment environment. Building and Testing the .NET Application

Gathering Files Needed for Deployment

Before beginning, verify you have access to the following files, created by the MATLAB programmer in Copying the Package You Created. The following files are required to deploy to users who do not have a copy of MATLAB installed:

*

MCR Installer. For locations of all MCR Installers, run the mcrinstaller command.
*

readme.txt

See Packaging Your Component (Optional) for more information about these files. You will also want to communicate the location of the MWArray Class Library Reference. You can also browse to this library from the MATLAB Builder NE help tree (left pane of MATLAB Product Help).

How Component Deployment Works. To deploy the component, run the MCR installer. The installer does the following:

1.

Installs the MCR (if not already installed on the target machine)
2.

Installs the component assembly in the folder from which the installer is run
3.

Copies the MWArray assembly to the Global Assembly Cache (GAC), as part of installing the MCR

Note Since installing the MCR requires write access to the system registry, you must have administrator privileges to run the MCR Installer.

Note On target machines where the MCR Installer is run, the MCR Installer puts the MWArray assembly in installation_folder\toolbox\dotnetbuilder\runtime\architecture
\version_number.

The MCR Installer uses a standard Microsoft installation file that provides the following features:

*

Integrates with Add/Remove Programs in the Control Panel
*

Checks software prerequisites before installation
*

Checks for proper user permissions
*

Rolls back the system to its prior state on installation failure
*

Supports component versioning

Using the Component in an Application

1.

Write source code for an application that uses the .NET component created in Building Your Component.

The C# source code for the sample application for this example is in MagicSquareExample\MagicSquareCSApp\MagicSquareApp.cs.

The program listing is shown here.

Tip Although MATLAB Builder NE generates C# code for the MagicSquare component and the sample application is in C#, applications that use the component do not need to be coded in C#. You can access the component from any CLS-compliant .NET language. For examples, see Sample Applications (Microsoft Visual Basic .NET).

MagicSquareApp.cs

// *******************************************************************************
//
// MagicDemoApp.cs
//
// This file is an example application for the MATLAB Builder NE product.
//
// Copyright 2001-2009 The MathWorks, Inc.
//
// *******************************************************************************

using System;

using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;

using MagicDemoComp;


namespace MathWorks.Demo.MagicSquareApp
{
///
/// The MagicSquareApp demo class computes a magic square of the user-specified size.
///

///
/// args[0] - a positive integer representing the array size.
///

class MagicDemoApp
{
#region MAIN

///
/// The main entry point for the application.
///

[STAThread]
static void Main(string[] args)
{
MWNumericArray arraySize= null;
MWNumericArray magicSquare= null;

try
{
// Get user-specified command line arguments or set default
arraySize= (0 != args.Length) ? System.Double.Parse(args[0]) : 4;

// Create the magic square object
MagicSquare magic= new MagicSquare();

// Compute the magic square and print the result
magicSquare= (MWNumericArray)magic.makesquare((MWArray)arraySize);

Console.WriteLine("Magic square of order {0}\n\n{1}", arraySize, magicSquare);

// Convert the magic square array to a two-dimensional native double array
double[,] nativeArray= (double[,])magicSquare.ToArray(MWArrayComponent.Real);

Console.WriteLine("\nMagic square as native array:\n");

// Display the array elements:
for (int i= 0; i < (int)arraySize; i++)
for (int j= 0; j < (int)arraySize; j++)
Console.WriteLine("Element({0},{1})= {2}", i, j, nativeArray[i,j]);

Console.ReadLine(); // Wait for user to exit application
}

catch(Exception exception)
{
Console.WriteLine("Error: {0}", exception);
}
}
#endregion
}
}

2.

Build the application using Visual Studio® .NET.

Note In the project file for this example, the MWArray assembly and the magic square component assembly have been prereferenced. Any references preceded by an exclamation point require you to remove the reference and rereference the affected assembly.

Note Microsoft .NET Framework version 2.0 is not supported by Visual Studio 2003.
1.

Open the project file for the Magic Square example (MagicSquareCSApp.csproj) in Visual Studio .NET.
2.

If necessary, add a reference to the MWArray component in matlabroot\toolbox\dotnetbuilder\bin\
architecture\framework_version.
3.

If necessary, add a reference to the Magic Square component (MagicSquareComp), which is in the distrib subfolder.

Distributing the Component to End Users

If you bundled the component as a self-extracting executable, paste it in a folder on the development machine and run it. If you are using a .zip file bundled with WinZip, unzip and extract the contents to the development machine.
Integrating .NET Classes Generated by MATLAB into a .NET Application

*

Classes and Methods
*

Component and Class Naming Conventions
*

Versioning
*

Managing Data Conversion Issues with MATLAB Builder NE Data Conversion Classes
*

Automatic Casting to MATLAB Types
*

Adding Fields to Data Structures and Data Structure Arrays
*

About MATLAB Array Indexing
*

Accessing Your Component On Another Computer

Classes and Methods. The builder project contains the files and settings needed by the MATLAB Builder NE product to create a deployable .NET component. A project specifies information about classes and methods, including the MATLAB functions to be included.

The builder transforms MATLAB functions that are specified in the component's project to methods belonging to a managed class.

When creating a component, you must provide one or more class names as well as a component name. The component name also specifies the name of the assembly that implements the component. The class name denotes the name of the class that encapsulates MATLAB functions.

To access the features and operations provided by the MATLAB functions, instantiate the managed class generated by the builder, and then call the methods that encapsulate the MATLAB functions.

Component and Class Naming Conventions. Typically you should specify names for components and classes that will be clear to programmers who use your components. For example, if you are encapsulating many MATLAB functions, it helps to determine a scheme of function categories and to create a separate class for each category. Also, the name of each class should be descriptive of what the class does.

The .NET Framework General Reference recommends the use of Pascal case for capitalizing the names of identifiers of three or more characters. That is, the first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. For example:

MakeSquare

In contrast, MATLAB programmers typically use all lowercase for names of functions. For example:

makesquare

By convention, the MATLAB Builder NE examples use Pascal case.

Valid characters are any alpha or numeric characters, as well as the underscore (_) character.

Versioning. The builder supports the standard versioning capabilities provided by the .NET Framework.

Note You can make side-by-side invocations of multiple versions of a component within the same application only if they access the same version of the MCR.

Managing Data Conversion Issues with MATLAB Builder NE Data Conversion Classes. To support data conversion between managed types and MATLAB types, the builder provides a set of data conversion classes derived from the abstract class, MWArray.

When you invoke a method on a component, the input and output parameters are a derived type of MWArray. To pass parameters, you can either instantiate one of the MWArray subclasses explicitly, or, in many cases, pass the parameters as a managed data type and rely on the implicit data conversion feature of .NET Builder.
Overview of Classes and Methods in the Data Conversion Class Hierarchy.

The data conversion classes are built as a class hierarchy that represents the major MATLAB array types.

Note See Overview for an introduction to the classes and see MWArray Class Library Reference (available online only) for details about this class library.

The root of the hierarchy is the MWArray abstract class. The MWArray class has the following subclasses representing the major MATLAB types: MWNumericArray, MWLogicalArray, MWCharArray, MWCellArray, and MWStructArray.

MWArray and its derived classes provide the following functionality:

*

Constructors and destructors to instantiate and dispose of MATLAB arrays
*

Properties to get and set the array data
*

Indexers to support a subset of MATLAB array indexing
*

Implicit and explicit data conversion operators
*

General methods

Advantage of Using Data Conversion Classes.

The MWArray data conversion classes allow you to pass most native .NET value types as parameters directly without using explicit data conversion. There is an implicit cast operator for most native numeric and string types that will convert the native type to the appropriate MATLAB array.

Automatic Casting to MATLAB Types.

Note Because the conversion process is automatic (in most cases), you do not need to understand the conversion process to pass and return arguments with MATLAB Builder NE components.

In most instances, if a native .NET primitive or array is used as an input parameter in a C# program, the builder transparently converts it to an instance of the appropriate MWArray class before it is passed on to the component method. The builder can convert most CLS-compliant string, numeric type, or multidimensional array of these types to an appropriate MWArray type.

Note This conversion is transparent in C# applications, but might require an explicit casting operator in other languages, for example, op_implicit in Visual Basic®.

Here is an example. Consider the .NET statement:

result = theFourier.plotfft(3, data, interval);

In this statement the third argument, namely interval, is of the .NET native type System.Double. The builder casts this argument to a MATLAB 1-by-1 double MWNumericArray type (which is a wrapper class containing a MATLAB double array).

See Data Conversion Rules for a list of all the data types that are supported along with their equivalent types in the MATLAB product.

Note There are some data types commonly used in the MATLAB product that are not available as native .NET types. Examples are cell arrays, structure arrays, and arrays of complex numbers. Represent these array types as instances of MWCellArray, MWStructArray, and MWNumericArray, respectively.

Adding Fields to Data Structures and Data Structure Arrays. When adding fields to data structures and data structure arrays, do so using standard programming techniques. Do not use the set command as a shortcut.

For examples of how to correctly add fields to data structures and data structure arrays, see the programming examples in Sample Applications (C#) and Sample Applications (Microsoft Visual Basic .NET).

About MATLAB Array Indexing. .NET Builder provides indexers to support a subset of MATLAB array indexing.

Note If each element in a large array returned by a .NET Builder component is to be indexed, the returned MATLAB array should first be converted to a native array using the toArray() method. This results in much better performance.

Don't keep the array in MATLAB type; convert it to a native array first. See Getting Started for an example of native type conversion.

Accessing Your Component On Another Computer. To implement your .NET component on a computer other than the one on which it was built:

1.

If the component is not already installed on the machine where you want to develop your application, run the self-extracting executable that you created in Deploying a Component Using the Magic Square Example.

This step is not necessary if you are developing your application on the same machine where you created the .NET component.
2.

Reference the .NET component in your Microsoft® Visual Studio® project or from the command line of a CLS-compliant compiler.

You must also add a reference to the MWArray component in matlabroot\toolbox\dotnetbuilder\bin\architecture\framework_version.
3.

Instantiate the generated .NET Builder classes and call the class methods as you would with any .NET class. To marshal data between the native .NET types and the MATLAB array type, you need to use either the MWArray data conversion classes or the MWArray native API. See MWArray Class Library Reference (available online only) for details about the MWArray API for this class library.

Building and Testing the .NET Application

1.

Build and test the .NET application as you would any application.
2.

Create an application installation package for end users that includes the files required for the .NET Builder components that encapsulate the MATLAB functions.

2010年4月7日星期三

doy 命令错误 找不到libgfortran.so.2--已解决

在suse11.0(机器AMD 64位,但安装了32位的suse)上编译了gcc4.2.0,并正确安装了gamit10.35,但在尝试doy命令时,出现如下错误,而sh_gamit命令可以正常显示。

估计是globk需要的这个库文件没有找到,并到/usr/lib下,寻找,确实没有,在网上找到包含libgfortran.so.2的包,安装后,终于正常。

/home/lwn> doy
doy: error while loading shared libraries: libgfortran.so.2: cannot open shared object file: No such file or directory
/home/lwn>

2010年4月6日星期二

gamit更新提醒10年04月05日-10年03月26日

** Incremental updates to be applied to Release 10.35 **

Last updated Mon 5 April 2010 14:00 UTC

Fix bug in sh_gamit when using IGS ultra-rapid orbits. King 100405


Improvements to sh_upd_stnfo to allow arbitrary input and output station.info names,
and to allow RINEX, IGS logs, or SINEX files to be in another directory. Copy
com/sh_upd_stnfo and kf/htoglb/mstinf.f. King 100402

Changes to make the downloading and use of orbit files and IONEX files
more robust. Copy /com/sh_gamit. King 100401

Fix bug in model that leads to an infinite loop when there are multiple mid-session
updates of station.info or coordinates. Copy gamit/model/get_antinfo.f. King 100331

Update gg/tables/ftp_info for SOPAC h-files, BKG met files, and OLG RINEX files. King 100330

Bug in mstinf (sh_upd_stnfo) due to failure to include gamit/lib/wstnfo.f
in the incremental updates of 100324. Fix is to include wstnfo.f and
remake globk/htoglb. King 100326

试图(1)


哈哈,可以传图片了哈!~

浏览统计