フィルターのクリア

Write a number and value to the same cell in excel?

5 ビュー (過去 30 日間)
Jess
Jess 2014 年 3 月 21 日
コメント済み: Jess 2014 年 3 月 21 日
This may be an obvious question, but is it possible to write a phrase to an excel spreadsheet such as "XXX grams" where XXX is a value from the program? I've tried used fprintf and sprintf commands to generate this but they only print the quoted portion to the command window. When I go to open the excel file, it prints and entirely wrong number. For example if i'm trying to print "1.25 grams", it will print 1 or some outrageous number such as 14 or 16.
Should I just give up and assume that matlab can't actually do this, or am I doing something wrong?
n = 1.25 % user desired value
A1 = fprintf('%f gram \n',n)
A2 = sprintf('%d gram \n',n)
xlswrite('MP_D.xls',A1,'M_Data','B2')

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 21 日
編集済み: Azzi Abdelmalek 2014 年 3 月 21 日
EDIT
n = 1.25 % user desired value
A = {sprintf('%d gram \n',n)}
xlswrite('MP_D.xls',A)
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 21 日
Look at edted answer
Jess
Jess 2014 年 3 月 21 日
Thank you!! Eventually I'll master these brackets... :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by