matlab에서 DOI (Digital Object Identifier)를 http://www.crossref.org으로 전송하여 bibtex 데이터를 가져 오려고합니다. this 소스에matlab에서 DOI를 전송하여 crossref에서 bibtex 데이터를 검색합니다.
curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842
을 기반 :
crossref API는 다음과 같이 제안합니다. 내가 루비 바위를 들었어요하지만
open("http://dx.doi.org/10.1038/nrd842","Accept" => "text/bibliography; style=bibtex"){|f| f.each {|line| print line}}
내가 MATLAB에서이 작업을 수행하려면 어떻게 루비 메시지를 번역하거나 crossref 명령을 해석하는 단서가 없다 :
here에서 또 다른 예는 ruby
에 다음과 같은 제안 .
clear
clc
doi = '10.1038/nrd842';
URL_PATTERN = 'http://dx.doi.org/%s';
fetchurl = sprintf(URL_PATTERN,doi);
numinputs = 1;
www = java.net.URL(fetchurl);
is = www.openStream;
%Read stream of data
isr = java.io.InputStreamReader(is);
br = java.io.BufferedReader(isr);
%Parse return data
retdat = [];
next_line = toCharArray(br.readLine)'; %First line contains headings, determine length
%Loop through data
while ischar(next_line)
retdat = [retdat, 13, next_line];
tmp = br.readLine;
try
next_line = toCharArray(tmp)';
if strcmp(next_line,'M END')
next_line = [];
break
end
catch
break;
end
end
%Cleanup java objects
br.close;
isr.close;
is.close;
도움말 뭔가 MATLAB에 루비 문을 번역 :
다음
포맷, 내가하여 BibTex crossref과 (가변retdat
)에 XML 데이터를 검색,하지만하는 도이을 보내 지금까지 무엇을 가지고 그와 같은 스크립트를 사용하여 보낼 수있는 크로스 레퍼런스와의 통신을 확립하기 위해 크게 감사하겠습니다.
편집 :> (또한, 루비의 아무 소용이, 그 문제를 해결하지만, "MATLAB"이 아니므 :.
추가 제약 (다시 적어도 R14에) 코드의 이전 버전과의 호환성을 포함 이 솔루션은 system('ruby script.rb')
를 통해 MATLAB에서 루비를 호출하는 방법에 대한 here를 참조하십시오.
로 대체되었을 때 상황이 일을 왜 대신 원시 자바 ['urlread'] (http://www.mathworks.com/help/matlab/ref /urlread.html)? – horchler
그것은 역사적인 것입니다 : 코드는 다른 앱에서 빌려 왔습니다. –
요청 헤더 및 기타 세부 정보를 설정하려면 [참조하십시오] (http://undocumentedmatlab.com/blog/expanding-urlreads-capabilities/). – horchler