-
Notifications
You must be signed in to change notification settings - Fork 3
/
29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser
1981 lines (1814 loc) · 101 KB
/
29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Get HTML-table data into MATLAB via urlread and without builtin browser - File Exchange - MATLAB Central</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script id='analyticsDigitalData'>
digitalData = {
'pageInstanceID' : 'Get HTML-table data into MATLAB via urlread and without builtin browser - File Exchange - MATLAB Central',
'page' : {
'pageInfo' : {
'pageID' : '/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser',
'destinationURL' : 'https://www.mathworks.com/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser'
},
'category' : {
'primaryCategory' : 'matlabcentral',
'subCategory1' : 'matlabcentral/fileexchange',
'subCategory2' : '',
},
'attributes' : {"descriptonCode":"FX_29642","category":["HTTP Interface"]}
},
'product' : [{ 'productInfo' : {} }],
'component' : [],
'events' : [],
'user': []
};
</script>
<!-- BEGIN Adobe DTM -->
<script src="//assets.adobedtm.com/d0cc0600946eb3957f703b9fe43c3590597a8c2c/satelliteLib-e8d23c2e444abadc572df06537e2def59c01db09.js"></script>
<!-- END Adobe DTM -->
<link href="/includes_content/responsive/css/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="/includes_content/responsive/css/site6.css?201507" rel="stylesheet" type="text/css">
<link href="/includes_content/responsive/css/site6_lg.css" rel="stylesheet" media="screen and (min-width: 1200px)">
<link href="/includes_content/responsive/css/site6_md.css" rel="stylesheet" media="screen and (min-width: 992px) and (max-width: 1199px)">
<link href="/includes_content/responsive/css/site6_sm+xs.css" rel="stylesheet" media="screen and (max-width: 991px)">
<link href="/includes_content/responsive/css/site6_sm.css" rel="stylesheet" media="screen and (min-width: 768px) and (max-width: 991px)">
<link href="/includes_content/responsive/css/site6_xs.css" rel="stylesheet" media="screen and (max-width: 767px)">
<link href="/includes_content/responsive/css/site6_print.css" rel="stylesheet" type="text/css" media="print">
<link rel="stylesheet" href="/includes_content/responsive/css/templates/mlc.css" type="text/css">
<!--[if IE 8]>
<link href="/includes_content/responsive/css/templates/mlc_ie8.css" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 9]>
<link href="/includes_content/responsive/css/templates/mlc_ie9.css" rel="stylesheet" type="text/css">
<![endif]-->
<link rel="stylesheet" href="/includes_content/responsive/css/apps/fileexchange/fileexchange.css">
<!--[if IE 8]>
<link href="/includes_content/responsive/css/apps/fileexchange/fileexchange_ie8.css" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 9]>
<link href="/includes_content/responsive/css/apps/fileexchange/fileexchange_ie9.css" rel="stylesheet" type="text/css">
<![endif]-->
<script src="/includes_content/responsive/scripts/jquery/jquery-latest.js"></script>
<script src="/includes_content/responsive/scripts/bootstrap/bootstrap.min.js"></script>
<script src="/includes_content/responsive/scripts/global.js"></script>
<script src="/includes_content/responsive/scripts/anchor.js"></script>
<link href="https://use.typekit.net/xvy5baa.css?display=swap" rel="stylesheet">
<link href="/includes_content/responsive/fonts/mathworks.woff" rel="preload" as="font" type="font/woff" crossorigin>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="sBc/CTgl7n0GLKY4NKULVTOxsskvl1au3xdSQ75cRXJn3zEE8ogyWjC52q/t5uxTwAkycmMuNI6qk5W2mxml4g==" />
<script src="/matlabcentral/fileexchange/assets/application-6656300507471dc1db58c37dc2a4f18bf8fa3733d0aa2862e949c219e7eb7e5e.js"></script>
<link rel="stylesheet" media="screen" href="/matlabcentral/fileexchange/assets/application-00637545ab0aaeebab1900c30088afee1bbb964d3cb86321ff92f4f2ab2387f2.css" />
<link rel="stylesheet" media="screen" href="/matlabcentral/fileexchange/assets/ui/application-b1b2e68dd4f081e8668be8584646c228985cf8d37200dbdaf725c3d114d12a82.css" />
<meta property="og:title" content="Get HTML-table data into MATLAB via urlread and without builtin browser" /><meta property="og:type" content="website" /><meta property="og:url" content="https://www.mathworks.com/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser" /><meta property="og:image" content="https://www.mathworks.com/responsive_image/165/120/0/0/0/cache/matlabcentral/mlc-downloads/downloads/submissions/29642/versions/1/screenshot.jpeg" /><meta property="og:description" content="Based on getTableFromWeb with a little more functionality for bring in table data from web to MATLAB" />
<link rel="canonical" href="https://www.mathworks.com/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser" />
<script src="https://www.mathworks.com/matlabcentral/jscript/profile_card_v1.2.js" data-app-name="fileexchange"></script>
<link href="/includes_content/responsive/css/site6_offcanvas.css" rel="stylesheet" type="text/css">
<!--[if IE 8]>
<link href="/includes_content/responsive/css/site6_offcanvas_ie8.css" rel="stylesheet" type="text/css">
<![endif]-->
<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery.cookie.js"></script>
<script type="text/javascript" src="/includes_content/domainSelect/akamai-country-code.js"></script>
<script type="text/javascript">
var domainCountryCodeMap = new Map();
var countryCodeToDomainMap = new Map();
domainCountryCodeMap.set('www.mathworks.com', 'www');
countryCodeToDomainMap.set('www','www.mathworks.com')
domainCountryCodeMap.set('www.mathworks.com', 'www');
countryCodeToDomainMap.set('www','www.mathworks.com')
domainCountryCodeMap.set('la.mathworks.com', 'la');
countryCodeToDomainMap.set('la','la.mathworks.com')
domainCountryCodeMap.set('au.mathworks.com', 'au');
countryCodeToDomainMap.set('au','au.mathworks.com')
domainCountryCodeMap.set('de.mathworks.com', 'de');
countryCodeToDomainMap.set('de','de.mathworks.com')
domainCountryCodeMap.set('nl.mathworks.com', 'nl');
countryCodeToDomainMap.set('nl','nl.mathworks.com')
domainCountryCodeMap.set('ww2.mathworks.cn', 'ww2');
countryCodeToDomainMap.set('ww2','ww2.mathworks.cn')
domainCountryCodeMap.set('se.mathworks.com', 'se');
countryCodeToDomainMap.set('se','se.mathworks.com')
domainCountryCodeMap.set('se.mathworks.com', 'se');
countryCodeToDomainMap.set('se','se.mathworks.com')
domainCountryCodeMap.set('fr.mathworks.com', 'fr');
countryCodeToDomainMap.set('fr','fr.mathworks.com')
domainCountryCodeMap.set('de.mathworks.com', 'de');
countryCodeToDomainMap.set('de','de.mathworks.com')
domainCountryCodeMap.set('in.mathworks.com', 'in');
countryCodeToDomainMap.set('in','in.mathworks.com')
domainCountryCodeMap.set('uk.mathworks.com', 'uk');
countryCodeToDomainMap.set('uk','uk.mathworks.com')
domainCountryCodeMap.set('it.mathworks.com', 'it');
countryCodeToDomainMap.set('it','it.mathworks.com')
domainCountryCodeMap.set('jp.mathworks.com', 'jp');
countryCodeToDomainMap.set('jp','jp.mathworks.com')
domainCountryCodeMap.set('kr.mathworks.com', 'kr');
countryCodeToDomainMap.set('kr','kr.mathworks.com')
domainCountryCodeMap.set('nl.mathworks.com', 'nl');
countryCodeToDomainMap.set('nl','nl.mathworks.com')
domainCountryCodeMap.set('nl.mathworks.com', 'nl');
countryCodeToDomainMap.set('nl','nl.mathworks.com')
domainCountryCodeMap.set('au.mathworks.com', 'au');
countryCodeToDomainMap.set('au','au.mathworks.com')
domainCountryCodeMap.set('se.mathworks.com', 'se');
countryCodeToDomainMap.set('se','se.mathworks.com')
domainCountryCodeMap.set('www.mathworks.com', 'www');
countryCodeToDomainMap.set('www','www.mathworks.com')
domainCountryCodeMap.set('es.mathworks.com', 'es');
countryCodeToDomainMap.set('es','es.mathworks.com')
domainCountryCodeMap.set('se.mathworks.com', 'se');
countryCodeToDomainMap.set('se','se.mathworks.com')
domainCountryCodeMap.set('ch.mathworks.com', 'ch');
countryCodeToDomainMap.set('ch','ch.mathworks.com')
domainCountryCodeMap.set('uk.mathworks.com', 'uk');
countryCodeToDomainMap.set('uk','uk.mathworks.com')
var countrySubdomains = {
US: {name: 'United States', subdomain: 'www'},
AD: {name: 'Andorra', subdomain: 'es'},
AR: {name: 'Argentina', subdomain: 'la'},
AU: {name: 'Australia', subdomain: 'au'},
AT: {name: 'Austria', subdomain: 'de'},
BE: {name: 'Belgium', subdomain: 'nl'},
BO: {name: 'Bolivia', subdomain: 'la'},
BV: {name: 'Bouvet Islands', subdomain: 'se'},
CA: {name: 'Canada', subdomain: 'www'},
CL: {name: 'Chile', subdomain: 'la'},
CN: {name: 'China', subdomain: 'cn'},
CX: {name: 'Christmas Island', subdomain: 'au'},
CC: {name: 'Cocos-Keeling Islands', subdomain: 'au'},
CO: {name: 'Colombia', subdomain: 'la'},
CR: {name: 'Costa Rica', subdomain: 'la'},
DK: {name: 'Denmark', subdomain: 'se'},
DO: {name: 'Dominican Republic', subdomain: 'la'},
EC: {name: 'Ecuador', subdomain: 'la'},
SV: {name: 'El Salvador', subdomain: 'la'},
EE: {name: 'Estonia', subdomain: 'se'},
FO: {name: 'Faroe Islands', subdomain: 'se'},
FJ: {name: 'Fiji', subdomain: 'au'},
FI: {name: 'Finland', subdomain: 'se'},
FR: {name: 'France', subdomain: 'fr'},
GF: {name: 'French Guiana', subdomain: 'fr'},
PF: {name: 'French Polynesia', subdomain: 'fr'},
DE: {name: 'Germany', subdomain: 'de'},
GL: {name: 'Greenland', subdomain: 'se'},
GP: {name: 'Guadalupe', subdomain: 'fr'},
GT: {name: 'Guatemala', subdomain: 'la'},
HN: {name: 'Honduras', subdomain: 'la'},
IS: {name: 'Iceland', subdomain: 'se'},
IN: {name: 'India', subdomain: 'in'},
IE: {name: 'Ireland', subdomain: 'uk'},
IT: {name: 'Italy', subdomain: 'it'},
JP: {name: 'Japan', subdomain: 'jp'},
KR: {name: 'Korea', subdomain: 'kr'},
LV: {name: 'Latvia', subdomain: 'se'},
LI: {name: 'Liechtenstein', subdomain: 'ch'},
LT: {name: 'Lithuania', subdomain: 'se'},
LU: {name: 'Luxembourg', subdomain: 'nl'},
MQ: {name: 'Martinique', subdomain: 'fr'},
YT: {name: 'Mayotte Island', subdomain: 'fr'},
MX: {name: 'Mexico', subdomain: 'la'},
MC: {name: 'Monaco', subdomain: 'fr'},
NL: {name: 'Netherlands', subdomain: 'nl'},
NC: {name: 'New Caledonia', subdomain: 'fr'},
NZ: {name: 'New Zealand', subdomain: 'au'},
NI: {name: 'Nicaragua', subdomain: 'la'},
NO: {name: 'Norway', subdomain: 'se'},
PA: {name: 'Panama', subdomain: 'la'},
PG: {name: 'Papua New Guinea', subdomain: 'au'},
PY: {name: 'Paraguay', subdomain: 'la'},
PE: {name: 'Peru', subdomain: 'la'},
PT: {name: 'Portugal', subdomain: 'www'},
PR: {name: 'Puerto Rico', subdomain: 'la'},
RE: {name: 'Reunion Island', subdomain: 'fr'},
ES: {name: 'Spain', subdomain: 'es'},
LK: {name: 'Sri Lanka', subdomain: 'in'},
SE: {name: 'Sweden', subdomain: 'se'},
CH: {name: 'Switzerland', subdomain: 'ch'},
GB: {name: 'United Kingdom', subdomain: 'uk'},
UY: {name: 'Uruguay', subdomain: 'la'},
VA: {name: 'Vatican City', subdomain: 'it'},
VE: {name: 'Venezuela', subdomain: 'la'},
};
var domainUtils = {
isExemptUrl: function (url) {
if(window.overrideDomainSelector){
return true;
}
var exemptions = [
'/api/parts/',
'nocookie=true',
'client=addons',
'requestedDomain'
];
return exemptions.some(function (exemption) {
return url.indexOf(exemption) != -1;
});
},
endsWith: function( str, suffix ) {
return str.substring( str.length - suffix.length, str.length ) === suffix;
},
getDomain: function (url) {
var segments = url.split('/');
return segments[2];
},
getSubdomain: function (domain) {
return domainCountryCodeMap.get(domain);
},
setCookies: function (domain, lang) {
var domainCookie = 'mathworks.com';
if (this.endsWith(location.host, 'mathworks.cn')) {
domainCookie = 'mathworks.cn';
}
var selectedSubdomain = this.getSubdomain(domain);
if (this.endsWith(domain, 'mathworks.cn')) {
selectedSubdomain = 'cn';
}
if (selectedSubdomain === 'www') {
// This is what ePS did in EQUUS and Ruby, so...
// we're just following suit.
selectedSubdomain = 'us';
}
if (selectedSubdomain !== 'cn' && selectedSubdomain !== 'ch') {
lang = '';
}
var cookieNames = this.getCookieNames(domain);
var expires = new Date();
expires.setFullYear(expires.getFullYear() + 68);
var myJSON = JSON.stringify({
domain: selectedSubdomain,
lang: lang,
v: 2
});
$.cookie(cookieNames.mwaPrefsCookieName, myJSON, {path: '/', expires: 20*365, domain: domainCookie});
},
getCookieNames: function (domain) {
var mwaLoginCookieName = 'mwa';
var mwaPrefsCookieName = 'mwa_prefs';
var subdomainSuffix = '';
if (subdomainSuffix != "") {
mwaLoginCookieName = mwaLoginCookieName + subdomainSuffix;
mwaPrefsCookieName = mwaPrefsCookieName + subdomainSuffix;
}
return {
mwaLoginCookieName: mwaLoginCookieName,
mwaPrefsCookieName: mwaPrefsCookieName,
};
},
switchDomain: function (targetDomain, targetLang) {
var targetUri = location.pathname;
targetLang = this.getValidLang(this.getSubdomain(targetDomain), targetLang);
var url = '//' + targetDomain;
url += targetUri + location.search;
url = url.replace(/requestedDomain=[a-z]?[a-z]?&?/, '');
url = url.replace(/\&$/, '');
url = url.replace(/\?$/, '');
var requestedDomainParam = 'requestedDomain=' + targetLang;
if (url.indexOf('?') > -1) {
url = url + '&' + requestedDomainParam;
} else {
url = url + '?' + requestedDomainParam;
}
window.location = url;
},
getPrefCookie: function(currentDomain) {
var cookieNames = this.getCookieNames(currentDomain);
// regex from: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
var cookieRegex = new RegExp("(?:(?:^|.*;\\s*)"+cookieNames.mwaPrefsCookieName+"\\s*\\=\\s*([^;]*).*$)|^.*$");
if (document.cookie) {
var cookieValue = document.cookie.replace(cookieRegex, "$1");
if (cookieValue) {
return JSON.parse(decodeURIComponent(cookieValue));
}
}
return "";
},
getPrefDomain: function (currentDomain) {
var mwaPrefsCookieJsonObject = this.getPrefCookie(currentDomain);
var visitorPrefDomain;
if (!!mwaPrefsCookieJsonObject) {
visitorPrefDomain = mwaPrefsCookieJsonObject.domain;
if (visitorPrefDomain === 'us') {
visitorPrefDomain = 'www';
}else if (visitorPrefDomain === 'cn') {
visitorPrefDomain = 'ww2';
}
}
return countryCodeToDomainMap.get(visitorPrefDomain);
},
getPrefLang: function (currentDomain) {
var mwaPrefsCookieJsonObject = this.getPrefCookie(currentDomain);
var multilingualDomainLanguageSupport = {};
multilingualDomainLanguageSupport['ch'] = ['en','de','fr'];
multilingualDomainLanguageSupport['cn'] = ['zh','en'];
var currentDomainLangOptions = multilingualDomainLanguageSupport[mwaPrefsCookieJsonObject.domain];
if (currentDomainLangOptions) {
var cookiePrefLang = mwaPrefsCookieJsonObject.lang;
if (currentDomainLangOptions.indexOf(cookiePrefLang) >= 0) {
return cookiePrefLang;
} else {
return currentDomainLangOptions[0];
}
}
return '';
},
getCookieVersion: function (currentDomain) {
var mwaPrefsCookieJsonObject = this.getPrefCookie(currentDomain);
return mwaPrefsCookieJsonObject.v;
},
getTargetDomainForCookies: function() {
var targetDomain = "";
if (this.endsWith(location.host, 'mathworks.cn')) {
targetDomain = window.location.protocol + "//" + countryCodeToDomainMap.get('www');
}else{
targetDomain = window.location.protocol + "//" + countryCodeToDomainMap.get('ww2');
}
return targetDomain;
},
getValidLang: function (subdomain, lang) {
var multilingualDomainLanguageSupport = {};
multilingualDomainLanguageSupport['ch'] = ['en','de','fr'];
multilingualDomainLanguageSupport['cn'] = ['zh','en'];
multilingualDomainLanguageSupport['ww2'] = ['zh','en'];
var currentDomainLangOptions = multilingualDomainLanguageSupport[subdomain];
if (currentDomainLangOptions) {
if (currentDomainLangOptions.indexOf(lang) >= 0) {
return lang;
} else {
return currentDomainLangOptions[0];
}
}
return '';
},
isDefaultLang: function (subdomain, lang) {
var multilingualDomainLanguageDefault = {};
multilingualDomainLanguageDefault['ch'] = 'en';
multilingualDomainLanguageDefault['cn'] = 'zh';
multilingualDomainLanguageDefault['ww2'] = 'zh';
var currentDomainLang = multilingualDomainLanguageDefault[subdomain];
if (currentDomainLang) {
if (currentDomainLang === lang) {
return true;
} else {
return false;
}
} else if (lang) {
return false;
}
return true;
}
};
$(window).on('load', function() {
var currentUrl = window.location.href;
var currentDomain = domainUtils.getDomain(currentUrl);
var currentSubdomain = domainUtils.getSubdomain(currentDomain);
var requestedDomainLangRegEx = RegExp('[?&]requestedDomain=([^&]*)').exec(window.location.search);
if (requestedDomainLangRegEx) {
var setLang = domainUtils.getValidLang(currentSubdomain, requestedDomainLangRegEx[1])
domainUtils.setCookies(currentDomain, setLang);
var URLWithoutRequestedDomain = window.location.href.replace(/requestedDomain=[a-z]?[a-z]?&?/, '');
URLWithoutRequestedDomain = URLWithoutRequestedDomain.replace(/\&$/, '');
URLWithoutRequestedDomain = URLWithoutRequestedDomain.replace(/\?$/, '');
history.replaceState({}, document.title, URLWithoutRequestedDomain);
window.location = URLWithoutRequestedDomain;
}
$('body').on('click', '.domain_selector_link', function (e) {
e.preventDefault();
var selectedDomain = domainUtils.getDomain(this.href);
var selectedLang = $(this).data('lang');
domainUtils.setCookies(selectedDomain, selectedLang);
domainUtils.switchDomain(selectedDomain, selectedLang);
});
var currentCountryText =
$('a[data-subdomain=\'' + currentSubdomain + '\'][data-default-lang=\'true\'][data-selected-text]')
.data('selected-text');
$('#countrySelectorButtonText').text(currentCountryText);
var visitorPrefDomain = domainUtils.getPrefDomain(currentDomain);
var visitorPrefLang = domainUtils.getPrefLang(currentDomain);
var akamaiCountryCode;
var akamaiprofile = CQ_Analytics.ClientContextMgr.getRegisteredStore('akamaiprofile');
if (akamaiprofile) {
akamaiCountryCode = akamaiprofile.getProperty('countryCode');
}
var recommendedSubdomain;
var recommendedLink;
if (akamaiCountryCode) {
if (countrySubdomains[akamaiCountryCode] !== undefined) {
recommendedSubdomain = countrySubdomains[akamaiCountryCode].subdomain;
} else {
recommendedSubdomain = 'www';
}
if (recommendedSubdomain === 'us') {
recommendedSubdomain = 'www';
}else if (recommendedSubdomain === 'cn') {
recommendedSubdomain = 'ww2';
}
recommendedLink = $('a[data-subdomain=\'' + recommendedSubdomain + '\'][data-recommended-text]');
} else if (visitorPrefDomain) {
recommendedSubdomain = domainUtils.getSubdomain(visitorPrefDomain);
if (visitorPrefLang) {
recommendedLink = $('a[data-subdomain=\'' + recommendedSubdomain + '\'][data-lang=\'' + visitorPrefLang + '\']');
} else {
recommendedLink = $('a[data-subdomain=\'' + recommendedSubdomain + '\'][data-default-lang=\'true\']');
}
}
if (!recommendedLink) {
recommendedSubdomain = 'www';
recommendedLink = $('a[data-subdomain=\'' + recommendedSubdomain + '\'][data-recommended-text]');
}
$('.recommended-country').text(recommendedLink.data('recommended-text'));
$('#recommended_domain_button').attr('href', recommendedLink.attr('href'));
$('#recommended_domain_button').attr('data-lang', recommendedLink.attr('data-lang'));
$('body').on('click', '#recommended_domain_button', function (e) {
e.preventDefault();
var selectedDomain = domainUtils.getDomain(this.href);
var selectedLang = $(this).data('lang');
domainUtils.setCookies(selectedDomain, selectedLang);
domainUtils.switchDomain(selectedDomain, selectedLang);
});
$('a.worldwide_link').attr('href', recommendedLink.attr('href'));
$('a.worldwide_link').data('lang', recommendedLink.data('lang'));
$('body').on('click', 'a.worldwide_link', function (e) {
e.preventDefault();
var selectedDomain = domainUtils.getDomain(this.href);
var selectedLang = $(this).data('lang');
domainUtils.setCookies(selectedDomain, selectedLang);
var href = e.target.getAttribute('href');
var worldwideLink = '/company/worldwide.html?s_tid=dmselect_cta&requestedDomain=';
if(href) {
location.href = href + worldwideLink;
}
});
if (akamaiCountryCode === 'CN') {
$('#china_performance_alert').show();
}
var crossDomain = "";
if(domainUtils.endsWith(currentDomain, '.mathworks.cn')){
crossDomain = countryCodeToDomainMap.get('www');
}else{
crossDomain = countryCodeToDomainMap.get('ww2');
}
if ((!domainUtils.endsWith(currentDomain, '.mathworks.com') && !domainUtils.endsWith(currentDomain, '.mathworks.cn')) || domainUtils.isExemptUrl(currentUrl)) {
return;
}
if (!visitorPrefDomain) {
if (akamaiCountryCode) {
var akamaiDeterminedSubdomain = $('a[data-country-code=\'' + akamaiCountryCode + '\']').data('subdomain');
if ((akamaiCountryCode.toLowerCase() === currentSubdomain) || (akamaiDeterminedSubdomain === currentSubdomain)) {
domainUtils.setCookies(currentDomain, "");
} else {
$('#country-unselected').modal('show');
}
return;
}
if (currentSubdomain === 'www') {
domainUtils.setCookies(currentDomain, '');
} else {
$('#country-unselected').modal('show');
}
} else if (akamaiCountryCode === 'CN' && !(visitorPrefDomain === 'CN') && !domainUtils.getCookieVersion(currentDomain)) {
$('#country-unselected').modal('show');
}
});
</script> <script src="/includes_content/responsive/scripts/mwa/global_nav.js"></script>
<script>!function(a){var e="https://s.go-mpulse.net/boomerang/",t="addEventListener";if("False"=="True")a.BOOMR_config=a.BOOMR_config||{},a.BOOMR_config.PageParams=a.BOOMR_config.PageParams||{},a.BOOMR_config.PageParams.pci=!0,e="https://s2.go-mpulse.net/boomerang/";if(window.BOOMR_API_key="LERXA-6VNES-W6PXS-U8C7F-BXSZH",function(){function n(e){a.BOOMR_onload=e&&e.timeStamp||(new Date).getTime()}if(!a.BOOMR||!a.BOOMR.version&&!a.BOOMR.snippetExecuted){a.BOOMR=a.BOOMR||{},a.BOOMR.snippetExecuted=!0;var i,_,o,r=document.createElement("iframe");if(a[t])a[t]("load",n,!1);else if(a.attachEvent)a.attachEvent("onload",n);r.src="javascript:void(0)",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="width:0;height:0;border:0;display:none;",o=document.getElementsByTagName("script")[0],o.parentNode.insertBefore(r,o);try{_=r.contentWindow.document}catch(O){i=document.domain,r.src="javascript:var d=document.open();d.domain='"+i+"';void(0);",_=r.contentWindow.document}_.open()._l=function(){var a=this.createElement("script");if(i)this.domain=i;a.id="boomr-if-as",a.src=e+"LERXA-6VNES-W6PXS-U8C7F-BXSZH",BOOMR_lstart=(new Date).getTime(),this.body.appendChild(a)},_.write("<bo"+'dy onload="document._l();">'),_.close()}}(),"".length>0)if(a&&"performance"in a&&a.performance&&"function"==typeof a.performance.setResourceTimingBufferSize)a.performance.setResourceTimingBufferSize();!function(){if(BOOMR=a.BOOMR||{},BOOMR.plugins=BOOMR.plugins||{},!BOOMR.plugins.AK){var e=""=="true"?1:0,t="",n="ilbp2fdijrsh2yd7gelq-f-a904d87e2-clientnsv4-s.akamaihd.net",i={"ak.v":"31","ak.cp":"31027","ak.ai":parseInt("195948",10),"ak.ol":"0","ak.cr":80,"ak.ipv":4,"ak.proto":"http/1.1","ak.rid":"8156026","ak.r":34806,"ak.a2":e,"ak.m":"x","ak.n":"essl","ak.bpcip":"66.194.253.0","ak.cport":62836,"ak.gh":"184.51.149.53","ak.quicv":"","ak.tlsv":"tls1.2","ak.0rtt":"","ak.csrc":"-","ak.acc":"bbr","ak.t":"1618948375","ak.ak":"hOBiQwZUYzCg5VSAfCLimQ==mlP8B+IxX3BbfJQUMsG3s23sSIvyueM8rI8zcRBQvutVbv9LEN6bYcQ9rTkBqdoLbHqDs8APZX/ukkpRtEIaonFOJOQZaagbjl/VPeFhnQ6YOyjh23yhk7kyDNd2sv5HZ5ZTM6B3h1CEiT5vwHnyNLYWP/pEZvXNQH0oK0PK9UINnheLuqGFL3OQgZeMv56N5qeRDX86/4R2pFPPBJPYKPuR9hjy0oROtcxDEpP/kUrB1TJCWYy/60lN9qxvwyRDQx5IVeeU/FpE/PzHfBbuSZb1pdaYjPq+sJPXe/u1aXvVc8ldvP6vMlqvH0lKMVz9yFOYkqwOLpsNNwo4tAdc5n7cgzxMW66CbCjFx634UCpW2r0m5+k5WFu2Y64AMJiCbIXYxl5P+rnUGNndkJbQ7ZUTHVo/b1/HvqYwypVO86U=","ak.pv":"119","ak.dpoabenc":""};if(""!==t)i["ak.ruds"]=t;var _={i:!1,av:function(e){var t="http.initiator";if(e&&(!e[t]||"spa_hard"===e[t]))i["ak.feo"]=void 0!==a.aFeoApplied?1:0,BOOMR.addVar(i)},rv:function(){var a=["ak.bpcip","ak.cport","ak.cr","ak.csrc","ak.gh","ak.ipv","ak.m","ak.n","ak.ol","ak.proto","ak.quicv","ak.tlsv","ak.0rtt","ak.r","ak.acc","ak.t"];BOOMR.removeVar(a)}};BOOMR.plugins.AK={akVars:i,akDNSPreFetchDomain:n,init:function(){if(!_.i){var a=BOOMR.subscribe;a("before_beacon",_.av,null,null),a("onbeacon",_.rv,null,null),_.i=!0}return this},is_complete:function(){return!0}}}}()}(window);</script></head>
<body id="responsive_b" class="mlc">
<a class="skip_link sr-only" href="#content_container">Skip to content</a>
<!-- Mobile TopNav: Start -->
<div class="header visible-xs visible-sm" id="header_mobile" translate="no">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="container-fluid">
<div class="row">
<div class="col-xs-3">
<button type="button" class="navbar-toggle topnav_toggle" data-toggle="collapse" data-target="#topnav_collapse">
<span class="sr-only">Toggle Main Navigation</span>
<span class="icon-menu"></span>
</button>
</div>
<div class="col-xs-6">
<div class="text-center">
<a href="https://www.mathworks.com?s_tid=gn_logo" class="svg_link navbar-brand">
<img src="/images/responsive/global/pic-header-mathworks-logo.svg" class="mw_logo" alt="MathWorks">
</a>
</div>
</div>
<div class="col-xs-3">
<div class="matrix_affordance_container_mobile" id="matrix_affordance_container_mobile"></div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row visible-xs visible-sm">
<div class="col-xs-12">
<div class="navbar-collapse collapse" id="topnav_collapse">
<ul class="nav navbar-nav" id="topnav">
<li class="topnav_products "><a href="https://www.mathworks.com/products.html?s_tid=gn_ps" >Products</a></li>
<li class="topnav_solutions "><a href="https://www.mathworks.com/solutions.html?s_tid=gn_sol">Solutions</a></li>
<li class="topnav_academia "><a href="https://www.mathworks.com/academia.html?s_tid=gn_acad">Academia</a></li>
<li class="topnav_support "><a href="https://www.mathworks.com/support.html?s_tid=gn_supp">Support</a></li>
<li class="topnav_community "><a href="https://www.mathworks.com/matlabcentral/?s_tid=gn_mlc">Community</a></li>
<li class="topnav_events "><a href="https://www.mathworks.com/company/events.html?s_tid=gn_ev">Events</a></li>
<li class="headernav_store"><a href="https://www.mathworks.com/products/get-matlab.html?s_tid=gn_getml">Get MATLAB</a></li>
</ul>
</div>
<div class="navbar-collapse collapse" id="matrix_collapse">
<div class="matrix_menu_container_mobile" id="matrix_menu_container_mobile"></div>
</div>
</div>
</div>
</div>
</nav>
</div>
<!-- Mobile TopNav: End -->
<!-- Desktop TopNav: Start -->
<div class="header hidden-xs hidden-sm" id="header_desktop" translate="no">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-md-9">
<div class="navbar-header">
<div class="logo_container hidden-xs hidden-sm">
<a href="https://www.mathworks.com?s_tid=gn_logo" class="svg_link pull-left">
<img src="/images/responsive/global/pic-header-mathworks-logo.svg" class="mw_logo" alt="MathWorks">
</a>
</div>
<div class="navbar-collapse collapse hidden-xs hidden-sm">
<ul class="nav navbar-nav" id="topnav">
<li class="topnav_products "><a href="https://www.mathworks.com/products.html?s_tid=gn_ps" >Products</a></li>
<li class="topnav_solutions "><a href="https://www.mathworks.com/solutions.html?s_tid=gn_sol">Solutions</a></li>
<li class="topnav_academia "><a href="https://www.mathworks.com/academia.html?s_tid=gn_acad">Academia</a></li>
<li class="topnav_support "><a href="https://www.mathworks.com/support.html?s_tid=gn_supp">Support</a></li>
<li class="topnav_community "><a href="https://www.mathworks.com/matlabcentral/?s_tid=gn_mlc">Community</a></li>
<li class="topnav_events "><a href="https://www.mathworks.com/company/events.html?s_tid=gn_ev">Events</a></li>
</ul>
</div>
</div>
</div>
<div class="col-md-3">
<div class="collapse navbar-collapse" id="headernav_collapse">
<ul class="nav navbar-nav navbar-right" id="headernav">
<li class="headernav_store"><a href="https://www.mathworks.com/products/get-matlab.html?s_tid=gn_getml" class="btn btn_color_blue companion_btn btn-xs">Get MATLAB</a></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
</div>
<!-- Desktop TopNav: End -->
<!-- Conjoined Header: Start -->
<div class="sticky_header_container includes_subnav">
<!-- Section Header: Start -->
<div class="section_header level_3">
<div class="container-fluid">
<div class="row" id="mobile_search_row">
<div class="col-sm-6 col-md-7 has_horizontal_local_nav" id="section_header_title">
<div class="section_header_content">
<div class="section_header_title add_cursor_pointer">
<p class="h1">File Exchange</p>
</div>
<button type="button" class="navbar-toggle collapsed subnav visible-xs visible-sm" data-toggle="collapse" data-target=".mobile_subnav_content"> <span class="icon-arrow-down icon_24"><span class="sr-only">Toggle Sub Navigation</span></span> </button>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-5" id="mobile_search">
<div class="search_nested_content_container">
<!-- Search File Exchange -->
<div id="search_scope_fx" class="collapse in">
<form id="fx_search_form" name="mlcsearch_form" method="get" data-language="en" action="/matlabcentral/fileexchange">
<div class="input-group tokenized_search_field">
<label class="sr-only">Search File Exchange</label>
<input type="search" class="form-control conjoined_search fileexchange-search" autocomplete="off" name="q" placeholder="Search File Exchange" id="fxsearch" value="" onfocus="this.value = this.value;">
<div class="input-group-btn">
<button type="button" class="btn btn_search_adjacent dropdown-toggle" data-toggle="dropdown" tabindex="-1"><span class="caret"></span><span class="search_scope_label">File Exchange</span></button>
<ul class="dropdown-menu list-unstyled dropdown-menu-right" role="menu">
<li data-toggle="collapse" data-target="#search_scope_support" class="site_search_scope_trigger"><a href="#">Support</a></li>
<li data-toggle="collapse" data-target="#search_scope_site" class="site_search_scope_trigger"><a href="#">MathWorks</a></li>
</ul>
<script>
$(".support_search_scope_trigger, .site_search_scope_trigger").click(function() {
$("#search_scope_fx").removeClass("in");
$("#query").val($("#fxsearch").val());
$("#supportsearch").val($("#fxsearch").val());
});
</script>
<button type="submit" id="submitsearch" class="btn icon-search btn_search_adjacent btn_search icon_16" tabindex="-1"></button>
</div>
</div>
</form>
</div>
<!-- End Search File Exchange -->
<!-- Support Search -->
<div id="search_scope_support" class="collapse">
<form id="supportsearch_form" name="supportsearch_form" method="get" data-language="en" action="/support/search_results.html">
<div class="input-group tokenized_search_field">
<label class="sr-only">Search Support</label>
<input type="search" class="form-control conjoined_search" autocomplete="off" name="q" placeholder="Search Support" id="supportsearch">
<div class="input-group-btn">
<button type="button" class="btn btn_search_adjacent dropdown-toggle" data-toggle="dropdown" tabindex="-1"><span class="caret"></span><span class="search_scope_label">Support</span></button>
<ul class="dropdown-menu list-unstyled dropdown-menu-right" role="menu">
<li data-toggle="collapse" data-target="#search_scope_fx" class="fileexchange_search_scope_trigger"><a href="#">File Exchange</a></li>
<li data-toggle="collapse" data-target="#search_scope_site" class="support_search_scope_trigger"><a href="#">MathWorks</a></li>
</ul>
<script>
$(".support_search_scope_trigger, .fileexchange_search_scope_trigger").click(function() {
$("#search_scope_support").removeClass("in");
$("#fxsearch").val($("#supportsearch").val());
$("#query").val($("#supportsearch").val());
});
</script>
<button type="submit" name="submitsearch" id="submitsearch" class="btn icon-search btn_search_adjacent btn_search icon_16" tabindex="-1"></button>
</div>
</div>
</form>
</div>
<!-- End Support Search -->
<!-- Search MathWorks.com -->
<div id="search_scope_site" class="collapse">
<form name="search" id="site_search" class="site_search" action="/search/site_search.html" method="get">
<div class="input-group">
<label class="sr-only">Search MathWorks.com</label>
<input type="hidden" name="c[]" value="entire_site">
<input type="search" name="q" id="query" class="form-control conjoined_search" placeholder="Search MathWorks.com" autocomplete="off" \="">
<div class="input-group-btn">
<button type="button" class="btn btn_search_adjacent dropdown-toggle" data-toggle="dropdown" tabindex="-1"><span class="caret"></span><span class="search_scope_label">MathWorks</span></button>
<ul class="dropdown-menu list-unstyled dropdown-menu-right" role="menu">
<li data-toggle="collapse" data-target="#search_scope_fx" class="fileexchange_search_scope_trigger"><a href="#">File Exchange</a></li>
<li data-toggle="collapse" data-target="#search_scope_support" class="support_search_scope_trigger"><a href="#">Support</a></li>
</ul>
<script>
$(".support_search_scope_trigger, .fileexchange_search_scope_trigger").click(function() {
$("#search_scope_site").removeClass("in");
$("#fxsearch").val($("#query").val());
$("#supportsearch").val($("#query").val());
});
</script>
<button type="submit" id="searchbutton" class="btn icon-search btn_search_adjacent btn_search icon_16" tabindex="-1"></button>
</div>
</div>
</form>
</div>
<!-- End Search -->
</div>
<button class="btn icon-remove btn_search pull-right icon_32 visible-xs" data-toggle="collapse" href="#mobile_search" aria-expanded="false" aria-controls="mobile_search"><span class="sr-only">Close Mobile Search</span></button>
</div>
<div class="visible-xs" id="search_actuator">
<button class="btn icon-search btn_search pull-right icon_16" data-toggle="collapse" href="#mobile_search" aria-expanded="false" aria-controls="mobile_search"><span class="sr-only">Open Mobile Search</span></button>
</div>
</div>
<script>
$(".section_header_title").click(function(){
$(window.location).attr('href', '/matlabcentral/fileexchange/');
});
</script>
<!-- Mobile Local Nav: Start -->
<div class="row visible-xs visible-sm" id="mobile_subnav">
<div class="col-xs-12">
<div class="navbar-collapse collapse mobile_subnav_content">
<ul class="nav navbar-nav subnav">
<li class="dropdown">
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">MATLAB Central<span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="topnav_community_home"><a href="/matlabcentral/?s_tid=gn_mlc">Community Home</a></li>
<li class="topnav_answers"><a href="/matlabcentral/answers/index/?s_tid=gn_mlc_an">MATLAB Answers</a></li>
<li class="topnav_fileexchange"><a href="/matlabcentral/fileexchange/?s_tid=gn_mlc_fx">File Exchange</a></li>
<li class="topnav_cody"><a href="/matlabcentral/cody/?s_tid=gn_mlc_cody">Cody</a></li>
<li class="topnav_blogs add_margin_10"><a href="https://blogs.mathworks.com/?s_tid=gn_mlc_blg">Blogs</a></li>
<hr class="add_margin_10 remove_margin_0">
<li class="topnav_distance_learning"><a href="/matlabcentral/topics/distance-learning.html?s_tid=gn_mlc_tbc_dl">Distance Learning Community</a></li>
<li class="topnav_simbiology"><a href="/matlabcentral/simbiology.html?s_tid=gn_mlc_tbc_sb">SimBiology Community</a></li>
<li class="topnav_power_electronics"><a href="/matlabcentral/topics/power-electronics-control.html?s_tid=gn_mlc_tbx_pec">Power Electronics Community</a></li>
<li class="topnav_thingspeak add_margin_10"><a href="/matlabcentral/topics/thingspeak.html?s_tid=gn_mlc_tbc_ts">ThingSpeak Community</a></li>
<hr class="add_margin_10 remove_margin_0">
<li class="topnav_treasure_hunt"><a href="/matlabcentral/community/onramps/mlc_treasure_hunt?s_tid=gn_mlc_hunt">Treasure Hunt</a></li>
<li class="topnav_highlights"><a href="/matlabcentral/highlights?s_tid=gn_mlc_hl">Highlights</a></li>
<li class="topnav_contests"><a href="/matlabcentral/contests.html?s_tid=gn_mlc_contests">Contests</a></li>
<li class="topnav_advisors"><a href="/matlabcentral/community-advisors.html?s_tid=gn_mlc_cab">Advisors</a></li>
<li class="topnav_badges"><a href="/matlabcentral/profile/badges/all?s_tid=gn_mlc_bdgs">Virtual badges</a></li>
<li class="topnav_about"><a href="/matlabcentral/about.html?s_tid=gn_mlc_about">About</a></li>
</ul>
</li>
<li><a id="leftnav_files" href="https://www.mathworks.com/matlabcentral/fileexchange/?s_tid=gn_mlc_fx_files">Files</a></li>
<li><a id="leftnav_authors" href="https://www.mathworks.com/matlabcentral/fileexchange/authors?s_tid=gn_mlc_fx_auth">Authors</a></li>
<li class="dropdown">
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">My File Exchange<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/matlabcentral/profile/authors/my_profile/activities">Activity Feed</a></li>
<li><a href="/matlabcentral/profile/authors/my_profile/follows">Manage Following</a></li>
<li><a href="/matlabcentral/profile/authors/my_profile/notification_preferences">Manage Notifications</a></li>
<li><a href="/matlabcentral/fileexchange/authors/my_fileexchange?s_tid=gn_mlc_fx_myfx" onclick="$(`#tabs a[href=#files_tab]`).tab('show')">My Files</a></li>
<li><a href="/matlabcentral/fileexchange/authors/my_fileexchange#feedback_tab" onclick="$(`#tabs a[href=#feedback_tab]`).tab('show')">My Comments and Ratings</a></li>
</ul>
</li>
<li class="maincta"><a class="submitfile" id="leftnav_submit" href="/contribute?s_tid=gn_mlc_fx_contr">Contribute</a></li>
<li class="about"><a class="hintanchor" id="leftnav_about" href="/matlabcentral/about/fx?s_tid=gn_mlc_fx_help">About</a></li>
</ul>
</div>
</div>
</div>
<!-- Mobile Local Nav: End -->
</div>
</div>
<!-- Section Header: End -->
<!-- Horo Nav: Start -->
<div class="horizontal_nav hidden-xs hidden-sm">
<div class="horizontal_nav_container">
<div class="container-fluid">
<div class="row">
<div class="col-md-8 col-lg-9 hidden-xs hidden-sm">
<nav class="navbar navbar-default" role="navigation" id="subnav">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">MATLAB Central<span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="topnav_community_home"><a href="/matlabcentral/?s_tid=gn_mlc">Community Home</a></li>
<li class="topnav_answers"><a href="/matlabcentral/answers/index/?s_tid=gn_mlc_an">MATLAB Answers</a></li>
<li class="topnav_fileexchange"><a href="/matlabcentral/fileexchange/?s_tid=gn_mlc_fx">File Exchange</a></li>
<li class="topnav_cody"><a href="/matlabcentral/cody/?s_tid=gn_mlc_cody">Cody</a></li>
<li class="topnav_blogs add_margin_10"><a href="https://blogs.mathworks.com/?s_tid=gn_mlc_blg">Blogs</a></li>
<hr class="add_margin_10 remove_margin_0">
<li class="topnav_distance_learning"><a href="/matlabcentral/topics/distance-learning.html?s_tid=gn_mlc_tbc_dl">Distance Learning Community</a></li>
<li class="topnav_simbiology"><a href="/matlabcentral/simbiology.html?s_tid=gn_mlc_tbc_sb">SimBiology Community</a></li>
<li class="topnav_power_electronics"><a href="/matlabcentral/topics/power-electronics-control.html?s_tid=gn_mlc_tbx_pec">Power Electronics Community</a></li>
<li class="topnav_thingspeak add_margin_10"><a href="/matlabcentral/topics/thingspeak.html?s_tid=gn_mlc_tbc_ts">ThingSpeak Community</a></li>
<hr class="add_margin_10 remove_margin_0">
<li class="topnav_treasure_hunt"><a href="/matlabcentral/community/onramps/mlc_treasure_hunt?s_tid=gn_mlc_hunt">Treasure Hunt</a></li>
<li class="topnav_highlights"><a href="/matlabcentral/highlights?s_tid=gn_mlc_hl">Highlights</a></li>
<li class="topnav_contests"><a href="/matlabcentral/contests.html?s_tid=gn_mlc_contests">Contests</a></li>
<li class="topnav_advisors"><a href="/matlabcentral/community-advisors.html?s_tid=gn_mlc_cab">Advisors</a></li>
<li class="topnav_badges"><a href="/matlabcentral/profile/badges/all?s_tid=gn_mlc_bdgs">Virtual badges</a></li>
<li class="topnav_about"><a href="/matlabcentral/about.html?s_tid=gn_mlc_about">About</a></li>
</ul>
</li>
<li><a id="leftnav_files" href="https://www.mathworks.com/matlabcentral/fileexchange/?s_tid=gn_mlc_fx_files">Files</a></li>
<li><a id="leftnav_authors" href="https://www.mathworks.com/matlabcentral/fileexchange/authors?s_tid=gn_mlc_fx_auth">Authors</a></li>
<li class="dropdown">
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">My File Exchange<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/matlabcentral/profile/authors/my_profile/activities">Activity Feed</a></li>
<li><a href="/matlabcentral/profile/authors/my_profile/follows">Manage Following</a></li>
<li><a href="/matlabcentral/profile/authors/my_profile/notification_preferences">Manage Notifications</a></li>
<li><a href="/matlabcentral/fileexchange/authors/my_fileexchange?s_tid=gn_mlc_fx_myfx" onclick="$(`#tabs a[href=#files_tab]`).tab('show')">My Files</a></li>
<li><a href="/matlabcentral/fileexchange/authors/my_fileexchange#feedback_tab" onclick="$(`#tabs a[href=#feedback_tab]`).tab('show')">My Comments and Ratings</a></li>
</ul>
</li>
<li class="maincta"><a class="submitfile" id="leftnav_submit" href="/contribute?s_tid=gn_mlc_fx_contr">Contribute</a></li>
<li class="about"><a class="hintanchor" id="leftnav_about" href="/matlabcentral/about/fx?s_tid=gn_mlc_fx_help">About</a></li>
</ul>
</div>
</nav>
</div>
<div class="col-md-4 col-lg-3 hidden-xs hidden-sm">
<div class="cta_box">
<ul class="list-inline">
<li class="cta_item cta_item_general "><a href="/campaigns/products/trials.html?eventid=56763&s_iid=mlcfx_trial_mlc_cta1" class="icon-download">Trial software</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Horo Nav: End -->
</div>
<!-- Conjoined Header: End -->
<div class="content_container" id="content_container" tabindex="-1">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<!-- JSON-LD for SEO purpose (see more at https://schema.org/) -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "Get HTML-table data into MATLAB via urlread and without builtin browser - File Exchange - MATLAB Central",
"accessibilitySummary": "Based on getTableFromWeb with a little more functionality for bring in table data from web to MATLAB",
"url": "https://www.mathworks.com/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser",
"datePublished": "07 Dec 2010",
"contributor": {
"@type": "Person",
"name": "Sven Koerner"
},
"contentRating": "4.5",
"commentCount": "20"
}
</script>
<div id="announcements_container"></div>
<div data-view="detail">
<div id="followSuccess" class="alert alert-success hidden"> <span class="alert_icon icon-alert-success"></span>
<h3>You are now following this Submission</h3>
<ul>
<li>You will see updates in your <a href='/matlabcentral/profile/authors/my_profile/activities'>activity feed</a></li>
<li>You may receive emails, depending on your <a href='/matlabcentral/profile/authors/my_profile/notification_preferences'>notification preferences</a></li>
</ul>
</div>
<script type="text/javascript">
$("#matlab_fileexchange_badge_copy").tooltip({trigger: 'manual'});
</script>
<!-- start-of-the-page-container -->
<div class="row">
<div class="col-xs-12">
<!-- start-of-the-header -->
<div class="row">
<div class="col-xs-12 col-sm-2">
<div id="thumbnail" class="text-center">
<a border="0" href="/matlabcentral/mlc-downloads/downloads/submissions/29642/versions/1/screenshot.jpeg"><img src="/responsive_image/165/120/0/0/0/cache/matlabcentral/mlc-downloads/downloads/submissions/29642/versions/1/screenshot.jpeg" alt="image thumbnail" itemprop="image" /></a>
</div>
</div>
<div class="col-xs-12 col-sm-10">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-9">
<h2 id="title" class="add_font_color_emphasize add_margin_5">
<span id="titleText">Get HTML-table data into MATLAB via urlread and without builtin browser</span>
</h2>
<div class="add_margin_5">
<span id="user_version" class="small add_font_color_mediumgray">version 1.0.0.0 (4.91 KB) by </span>
<span><a class="author_inline analyticsMlcProfileModal results_author" data-locale-id="en-US" href="/matlabcentral/profile/authors/2235757">Sven Koerner</a>
</span>
</div>
<div id="summary" class="add_text_wrapping">
<span id="summaryText">Based on getTableFromWeb with a little more functionality for bring in table data from web to MATLAB</span>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-3 section_downsize">
<div class="pull-right">
<div class="rating add_margin_5 text-right" title="4.50 out of 5 Stars">
<span class="numberrating">
<div class="rate_scale">
<div class="rated" style="width: 90.0%;">
<span id="rating_value">4.5</span>
</div>
</div>
<a href="#feedbacks"><span id="rating_count">16 Ratings</span> </a>
</span>
</div>
<p class="add_margin_0 text-right">
<span id="downloads">19 Downloads</span>
<span class="icon_16 icon-info-circle" data-container="body" data-toggle="popover" role="button" tabindex="0" data-trigger="focus" data-placement="left" title="" data-content="Last 30 days: 19<br> All time: 7,342" data-original-title="Downloads" aria-describedby="popover506129"></span>
</p>
<p class="add_margin_0 text-right">
<span id="date_updated">Updated
<span content="2010-12-07">07 Dec 2010</span>
</span>
</p>
<p class="text-right"><a data-toggle="modal" href="#license_modal">View License</a></p>
<div class="modal fade" id="license_modal" tabindex="-1" role="dialog" aria-labelledby="license_modal_title" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title" id="license_modal_title">License</h3>
</div>
<div class="modal-body">
<iframe src="/matlabcentral/mlc-downloads/downloads/e5761172-4a80-11e4-9553-005056977bd0/8995a6c2-34df-0504-e73f-f81dd3af8ff5/licenses/license.txt" style="border: none" frameborder="0"></iframe>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12">
<ul class="list-inline pull-right add_clear_both">
<li class="add_margin_0">
<a href="https://www.mathworks.com/login?uri=https%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Ffileexchange%2F29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser&form_type=community" class="btn btn-sm companion_btn btn_color_blue"><span class="icon-add"></span>Follow</a>
</li>
<!-- Start Download action -->
<li>
<div data-visible-on="add">
<div><a title="Download" data-logintodownload="true" class="btn btn-sm btn_color_blue btn-block link--download" href="https://www.mathworks.com/login?uri=https%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Ffileexchange%2F29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser&form_type=community">Download</a></div>
</div>
</li>
<!-- End Download action -->
</ul>
</div>
</div>
</div>
</div>
<!-- end-of-the-header -->
<!-- start-of-the-tabs -->
<div class="row">
<div class="col-xs-12">
<div class="all-tabs-container">
<div>
<ul role="tablist" class="nav nav-tabs responsive" id="add_on_files">
<li class="active">
<a role="tab" data-toggle="tab" href="#overview_tab">Overview</a>
</li>
<li class="">
<a role="tab" data-toggle="tab" href="#functions_tab">Functions</a>
</li>
</ul>
</div>
<div class="tab-content responsive">
<div class="tab-pane active" id="overview_tab" data-context="web">
<div class="row">
<div class='col-xs-12 col-md-9' >
<div id="description" data-add-on-description="true" class="add_margin_30 add_text_wrapping">
<div id="descriptionBody"><p>Function getTableFromWeb_mod is based on the very very good "pick of the week" from August 20th, 2010 (<a href="http://www.mathworks.com/matlabcentral/fileexchange/22465-get-html-table-data-into-matlab" target="_blank" rel="nofollow noopener noreferrer">http://www.mathworks.com/matlabcentral/fileexchange/22465-get-html-table-data-into-matlab</a>) by Jeremy Barry.
<br />It is inspired by the restrictions of the original function and should users help, who had problems with the loading time of the requested webpage. So the workaround doesn't use the internal webbrowser by Matlab but takes the urlread function to import and analyze the table-webdata.</p>
<p>To get table data, it is necessary to know from which url you want to read in the data and from which
<br />table. If you have an url but no idea which table with the specified tablenummer has the data use the originalfuntion getTableFromWeb
<br />(<a href="http://www.mathworks.com/matlabcentral/fileexchange/22465-get-html-table-data-into-matlab" target="_blank" rel="nofollow noopener noreferrer">http://www.mathworks.com/matlabcentral/fileexchange/22465-get-html-table-data-into-matlab</a>) to check which tablenumber with content you are interested in.</p>
<p>The first example(at the end of description) gets actual departure information by german railways for the railwaystation Frankfurt Hbf (coded by ibnr, international railway station number).</p>
<p>The second example belongs to the orinigal example by Jeremy Barry and gets financial information.</p>
<p>There are two input arguments:
<br />url_string -- is the string of the requested webpage
<br />nr_table -- number of table to get and to put in out_table</p>
<p>Ouput argument:
<br />out_table -- is a cell array of requested data</p>
<p>Example:</p>
<p>% German Railways-travelling information example
<br /> ibnr = 8098105; % IBNR railway station: Frankfurt-Hbf (for more ibnr see: <a href="http://www.ibnr.de.vu/" target="_blank" rel="nofollow noopener noreferrer">http://www.ibnr.de.vu/</a>)
<br /> url_string = [ '<a href="http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn?rt=1&ld=10000&evaId=" target="_blank" rel="nofollow noopener noreferrer">http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn?rt=1&ld=10000&evaId=</a>', num2str(ibnr) ,'&boardType=dep&time=actual&productsDefault=1111000000&start=yes']; % question string fo calling actual departure information for Frankfurt HBF
<br /> nr_table = 2; % Table with the travelinformation data
<br /> out_table = getTableFromWeb_mod(url_string, nr_table)</p>
<p>% Finance example
<br />% run getTableDataScript to see, which table is number 7 (Valuation Measures)
<br />url_string = ('<a href="http://finance.yahoo.com/q/ks?s=GOOG" target="_blank" rel="nofollow noopener noreferrer">http://finance.yahoo.com/q/ks?s=GOOG</a>');
<br />nr_table = 7;
<br />out_table = getTableFromWeb_mod(url_string, nr_table)
</p></div>
</div>
<div id="citation" class="add_margin_30 add_text_wrapping">
<h3 class="add_bottom_rule add_margin_5">
Cite As
</h3>
<p id="defaultCitation" class="add_margin_20">
Sven Koerner (2021). <span id="defaultCitationTitle">Get HTML-table data into MATLAB via urlread and without builtin browser</span> (https://www.mathworks.com/matlabcentral/fileexchange/29642-get-html-table-data-into-matlab-via-urlread-and-without-builtin-browser), MATLAB Central File Exchange.
Retrieved <time datetime="2021-04-20 19:52:56 UTC">April 20, 2021</time>.
</p>
</div>