sendolmail a cell array?

3 ビュー (過去 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 Center および File ExchangeWeb Services についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by