自己电脑做网站要下载,wap网页编写,如何自己做淘宝网站,营销网站建设广西这是我参考MATLAB函数改写后的函数#xff0c;基本可以满足你的要求#xff0c;支持11字节的16进制数的string或string array或cell array输入和相应的输出并且具有检错功能#xff0c;程序健壮性良好function dyour_solution(h)%YOUR_SOLUTION Convert 11-bytes hexadecima…这是我参考MATLAB函数改写后的函数基本可以满足你的要求支持11字节的16进制数的string或string array或cell array输入和相应的输出并且具有检错功能程序健壮性良好function dyour_solution(h)%YOUR_SOLUTION Convert 11-bytes hexadecimal string to your specific decimal integer.% D your_solution(H) interprets the 11-byte hexadecimal string H and returns in D the% equivalent decimal number.%% If H is a character array or cell array of strings, each row is interpreted% as a 11-bytes hexadecimal string.%% EXAMPLES:% your_solution(E3AABBCCDDEEFF00998877) and your_solution(e3aabbccddeeff00998877)% both return 65518%% Reference MATLAB function: DEC2HEX, HEX2NUM, BIN2DEC, BASE2DEC.% Author: Neptune_zx(www.ilovematlab.cn): 10-30-2010, HFUT.if iscellstr(h), h char(h); endif isempty(h), d []; return, end% Work in upper case.h upper(h);[m,n]size(h);if(n~22)error( Does not support the hexadecimal string of non 11-bytes);end% Right justify strings and form 2-D character array.if ~isempty(find((h | h0),1))error([ there are some non 11-bytes hexadecimal strings which do not support,...be sure your strings are all 11-bytes])end% Check for out of range valuesif any(any(~((h0 h9) | (hAhF))))error(Input string found with characters other than 0-9, a-f, or A-F.);endh reshape(h,m,n);hh(:,16:-1:11);n6;%compute the results and returns in dsixteen 16;p fliplr(cumprod([1 sixteen(ones(1,n-1))]));p p(ones(m,1),:);d h 64; % Numbersh(d) h(d) - 48;d h 64; % Lettersh(d) h(d) - 55;d sum(h.*p,2);%EXAMPLE your_solution({E3AABBCCDDDEFFF0f98877,AABBCCDDEEFF11223344556677})??? Error using your_solution at 26Does not support the hexadecimal string of non 11-bytes your_solution({E3AABBCCDDDEFFF0f98877,AABBCCDDEEFF1122334455})ans 10485572232831[本帖最后由 Neptune_zx 于 2010-10-30 20:19 编辑]