how to use range that can change in xlswrite?

if I write a function that creates a sturcture that can change sizes in different calls. and I want to put this structure in xl starting from B1(cause in A1:A4 THERE IS SOMETHING ELSE), but I don't know the end of the range since the structure can change it size - is there a way of doing so?

Answers (1)

ilona, you probably just forgot to give the sheet name when you called xlswrite. Or you didn't construct the full cell reference range like 'B1:H9'. Try this code:
myStructure.array = rand(10,3) % Make sample data in a structure.
% You must give a sheet name unless you want to
% figure out where the lower right corner of the array would go.
% To do that you'd need ExcelCol.m in the File Exchange
% If you give sheetName, you can give just the upper left cell.
sheetName = 'Results'
xlswrite('test.xlsx', myStructure.array, sheetName, 'B1')

Asked:

on 4 Jan 2014

Answered:

on 4 Jan 2014

Community Treasure Hunt

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

Start Hunting!