필터 지우기
필터 지우기

sendolmail a cell array?

조회 수: 7 (최근 30일)
Zoe Zhang
Zoe Zhang 2012년 2월 22일
Does anyone know how to send a variable (cell array) using sendolmail(outlook version of sendmail) or sendmail?
So in the email body, receivers could get
'Security' 'Name' 'Quantity' 'Price'
'F2TEZ3-13' 'Fr Tel div DEC3' [ 2000] [ 0.8800]
'SNDZ2-13' 'NIKKEI DIV DEC12' [ 500] [ 188.3000]
'T2QIZ2-12' 'Tel Itl div DEC2' [ -1000] [ 0.0500]
'R2WEZ2-12' 'RWE div DEC2' [ 150] [ 2.0060]
'FEXDZ3-13' 'ESTX 50 Div DEC3' [ 1412] [ 105.8000]
'FEXDZ2-12' 'ESTX 50 Div DEC2' [ 250] [ 117.8000]
'E2NLZ2-12' 'ENEL div DEC2' [ -1100] [ 0.1500]
'S2SDZ2-12' 'Santand div DEC2' [ 3510] [ 0.5400]
'FEXD1000X3.EX-13' 'OEXD DEC3 100 P' [ 1400] [ 5.8600]
'B2NPZ2-12' 'BNP Par div DEC2' [ -325] [ 1.2000]
Thanks in advance !

채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 22일
You would have to serialize the cell array and send it as an attachment.
Unfortunately the MATLAB serialization routines have no user interface, so you end up having to write your own serialization routines.
Sometimes the easiest thing to do is to save the cell array as a .mat file and attach the .mat file.
  댓글 수: 2
Zoe Zhang
Zoe Zhang 2012년 2월 22일
Serialization sounds hard... I could try but I guess eventually I ll just attach excel file for those receivers as what I usually do(they don't have Matlab).
Thank you Mr.Raccoon~
Zoe Zhang
Zoe Zhang 2012년 2월 22일
http://www.mathworks.com/matlabcentral/fileexchange/12063-serialize
I found a file here to do the serialization. (Not sure if this is what u were referring to though.) The function works and returns me
>> m
m =
reshape({sprintf('Security'), sprintf('F2TEZ3-13'), sprintf('SNDZ2-13'),...)
I attached the very long variable m but it still didn't work... sendolmail('qzhang','Exposure','Thanks!',{m});
Do need to do sth else or am I completely not on the right track here? Thanks~

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2012년 2월 22일
sendolmail expects the attachments to be filenames, and not the actual data. So you have to use save at first and supply the name of the created file.
m = {'Security', 'F2TEZ3-13', 'SNDZ2-13', ...
save('m_as_MatFile.mat', 'm');
sendolmail('qzhang', 'Exposure', 'Thanks!', {'m_as_MatFile.mat'})
  댓글 수: 1
Zoe Zhang
Zoe Zhang 2012년 2월 22일
Thank you! So I need to serialized the cell array say as variable m, then I save m in data.mat, and send data.mat as attachment?
So it would be:
filename = 'S:\data.mat'
sendolmail('qzhang','Exposure','Thanks!',{filename})

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by