Url-escape забавных персонажей с кодами персонажей.
function foo
%FOO Function with funny help links
%
% Link to <a href="http://en.wikipedia.org/wiki/Kernel_%28statistics%29">some page</a>.
Функция Matlab urlencode () покажет вам, какие коды использовать. Но сохраняйте двоеточие и косые черты как есть.
>> disp(urlencode('Kernel_(statistics)'))
Kernel_%28statistics%29
Вот функция, которая будет заключать в кавычки элементы URL-пути, сохраняя части, которые необходимо оставить без изменений.
function escapedUrl = escape_url_for_helptext(url)
ixColon = find(url == ':', 1);
if isempty(ixColon)
[proto,rest] = deal('', url);
else
[proto,rest] = deal(url(1:ixColon), url(ixColon+1:end));
end
parts = regexp(rest, '/', 'split');
encodedParts = cellfun(@urlencode, parts, 'UniformOutput', false);
escapedUrl = [proto join(encodedParts, '/')];
function out = join(strs, glue)
strs(1:end-1) = strcat(strs(1:end-1), {glue});
out = cat(2, strs{:});
Чтобы использовать его, просто введите весь URL.
>> escape_url_for_helptext('http://en.wikipedia.org/wiki/Kernel_(statistics)')
ans =
http://en.wikipedia.org/wiki/Kernel_%28statistics%29