How to import text present in figure to excel?

1 view (last 30 days)
yojitha etikala
yojitha etikala on 27 Jan 2022
Commented: Ankit on 3 Feb 2022
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 Comments
yojitha etikala
yojitha etikala on 28 Jan 2022
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

Sign in to comment.

Answers (1)

Ankit
Ankit on 28 Jan 2022
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 Comments
Ankit
Ankit on 3 Feb 2022
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..

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by