Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve bibtex data from crossref by sending DOI from matlab: translation from ruby
    primarykey
    data
    text
    <p>I want to retrieve bibtex data (for building a bibliography) by sending a DOI (Digital Object Identifier) to <a href="http://www.crossref.org" rel="nofollow noreferrer">http://www.crossref.org</a> from within matlab. </p> <p>The crossref API suggests something like this:</p> <pre><code>curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842 </code></pre> <p>based on <a href="http://www.crossref.org/CrossTech/2011/11/turning_dois_into_formatted_ci.html" rel="nofollow noreferrer">this</a> source.</p> <p>Another example from <a href="https://tex.stackexchange.com/questions/6848/automatically-dereference-doi-to-bib">here</a> suggests the following in <code>ruby</code>:</p> <pre><code>open("http://dx.doi.org/10.1038/nrd842","Accept" =&gt; "text/bibliography; style=bibtex"){|f| f.each {|line| print line}} </code></pre> <p>Although I've heard ruby rocks I want to do this in matlab and have no clue how to translate the ruby message or interpret the crossref command. </p> <p>The following is what I have so far to send a doi to crossref and retrieve data in xml (in variable <code>retdat</code>), but not bibtex, format:</p> <pre><code>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; </code></pre> <p>Help translating the ruby statement to something matlab can send using a script such as that posted to establish the communication with crossref would be greatly appreciated. </p> <p><strong>Edit:</strong></p> <p>Additional constraints include backward compatibility of the code (back at least to R14) :>(. Also, no use of ruby, since that solves the problem but is not a "matlab" solution, see <a href="https://stackoverflow.com/questions/17934732/open-url-to-resolve-doi-with-ruby-from-dos-command-line/17935584?noredirect=1#comment26207928_17935584">here</a> for how to invoke ruby from matlab via <code>system('ruby script.rb')</code>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload