How to import text present in figure to excel?

1 回表示 (過去 30 日間)
yojitha etikala
yojitha etikala 2022 年 1 月 27 日
コメント済み: Ankit 2022 年 2 月 3 日
Hello,
I wrote text in figure.For example:
figure
axis off
text(0,0.5,sprintf([ 'speed = %0.1f kmph (%0.1f miles/hour)\n'
'time = %0.1f min \n '
],speed,time;
And the output:
speed= 55kmph(30miles/hour)
time= 35min
How want import this output to excel?
Thank you in advance
  2 件のコメント
Rik
Rik 2022 年 1 月 28 日
Do you want to export the text as text? Or the figure as an image?
yojitha etikala
yojitha etikala 2022 年 1 月 28 日
Hello Rik,
I want to export the text as text.
I want to see below output in the excel.
speed= 55kmph(30miles/hour)
time= 35min
Thank you

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

回答 (1 件)

Ankit
Ankit 2022 年 1 月 28 日
There is one way to write the output to *.xlsx-File.
speed= 55;
time= 35;
filename = 'Test.xlsx';
str = sprintf(['speed = %0.3f kmph \n' 'time = %0.1f min \n '],speed,time);
text(0,0.5,str);
OutPut = cellstr(str);
writetable(cell2table(OutPut),filename);
  12 件のコメント
Rik
Rik 2022 年 2 月 3 日
If the goal is to write something to an excel file, why is the text function used at all? That is an unnecessary step that still confuses me.
Ankit
Ankit 2022 年 2 月 3 日
Yes one can avoid that step but it is not clear how he is getting the data. I just used the def values.. whether he is displaying that data in figure etc.. if not then text command is not required..

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by