06.08.2013 Views

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

input_buf0=(char *)mxCalloc(buflen0,sizeof(char));<br />

input_buf1=(char *)mxCalloc(buflen1,sizeof(char));<br />

output_buf=(char *)mxCalloc(buflen,sizeof(char));<br />

//<br />

status=mxGetString(prhs[0],input_buf0,buflen0);<br />

if (status!=0)<br />

//<br />

mexWarnMsgTxt("Not enough space,String is truncated.");<br />

//<br />

status=mxGetString(prhs[1],input_buf1,buflen1);<br />

if (status!=0)<br />

//<br />

mexWarnMsgTxt("Not enough space,String is truncated.");<br />

stringplus(input_buf0,input_buf1,output_buf);<br />

//<br />

plhs[0]=mxCreateString(output_buf);<br />

return;<br />

//<br />

(3)<br />

cd d:\mywork<br />

mex exm120153_1.cpp<br />

(4)<br />

根据以上分析,就可以写出下列 exm120153_1.m 文件:<br />

% exm120153_1.m Two strings are concatenated into a larger string.<br />

% Cstr=exm120153_1(Astr, Bstr) 把字符串 Astr 和 Bstr 水平串联<br />

% Astr 被串联的“单行”字符串<br />

% Bstr 被串联的“单行”字符串<br />

% Cstr 由 Astr 在前,Bstr 在后,串联而成的字符串。<br />

% 2002 年 11 月编写<br />

(5)<br />

A='1234';B='abcd';<br />

C=exm120153_1(A,B)<br />

C =<br />

1234abcd<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!