Clear Filters
Clear Filters

modify xlswritefig to use already existing file?

1 view (last 30 days)
How can I adapt this code to write to a file that already exists (is being created)? For example, if I have this line that works great:
xlswrite(filename, percentError, 1, 'C4');
and I want to put a figure next to the data, I'd like to write something like:
xlswritefig(gcf, filename, 'Sheet1', 'E2')
Which seems like it should work but I get a long error:
Error using Interface.000208DB_0000_0000_C000_000000000046/invoke Invoke Error, Dispatch Exception: Source: Microsoft Excel Description: 'C:\Users\User\Documents\MATLAB\C:\Users\User\Dropbox\MATLAB\002 Human Machine\v6_1\results_20131102_222147.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct.
If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. Help File: xlmain11.chm Help Context ID: 0
Error in xlswritefig (line 79) op = invoke(Excel.Workbooks, 'open', [pwd filesep filename]);
Error in calcResults_v6_1 (line 226) xlswritefig(gcf, filename, 'Sheet1', 'E2')
Any thoughts? The file clearly exists because it was created and being written to with data, but the way xlswritefig is written (or the way I'm calling it) won't let me write a figure to the already existing file. I also don't open the file before or as I am writing to it and don't need to, if that's helpful at all. Thanks!

Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!