urlread retrieves data but webread retrieves error
2 ビュー (過去 30 日間)
古いコメントを表示
I'd like to retrieve data from a .csv generated by a website. urlread works, but is not recommended. webread returns a http error message. Anyone know what feature of webread causes different behavior than urlread? Alternatively, is there a script to just download the file (e.g. web.m but without the interactive browser)?
>> urlread('https://ssd.jpl.nasa.gov/sbdb_query.cgi?com_orbit_class=JFC;table_format=CSV;c_fields=AbAc;&query=1')
ans =
'spkid,full_name
1000099," 8P/Tuttle"
1000061," 96P/Machholz 1"
1000047," 126P/IRAS"
1000154," 262P/McNaught-Russell"
1003435," 333P/LINEAR"
1002585," 342P/SOHO"
1001439," P/1999 J6 (SOHO)"
1001843," C/2002 R5 (SOHO)"
1001852," P/2002 S7 (SOHO)"
1002413," P/2006 R1 (Siding Spring)"
1003317," P/2008 Y12 (SOHO)"
1003064," P/2010 D2 (WISE)"
1003231," P/2013 AL76 (Catalina)"
1003377," C/2015 D1 (SOHO)"
'
>> webread('https://ssd.jpl.nasa.gov/sbdb_query.cgi?com_orbit_class=JFC;table_format=CSV;c_fields=AbAc;&query=1')
ans =
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>ERROR</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="#FFFFFF" link="#FF0000" vlink="#0000FF">
<h2>Error Condition</h2>
</body>
</html>
0 件のコメント
採用された回答
Damon Landau
2018 年 5 月 25 日
2 件のコメント
Mark Magdaleno
2021 年 5 月 13 日
I have the same issue.
How is this an "Accepted Answer"? If I understand the fix is to manully edit the file to change the delimiters by hand?
Can webread delimiter be user settable? If not will urlread stay put until it does?
Walter Roberson
2021 年 5 月 13 日
url = 'https://ssd.jpl.nasa.gov/sbdb_query.cgi?com_orbit_class=JFC;table_format=CSV;c_fields=AbAc;&query=1'
url_amp = regexprep(url, ';', '&')
char(webread(url_amp).')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!