From: William on 9 Jun 2010 22:05 I've been having a little difficulty with an xlswrite command, and was hoping someone could help. I have the following code: xlssheetnames={'AllYrStatistics'; '7YrStatistics'; '5YrStatistics'; '3YrStatistics'; '2YrStatistics'; '1YrStatistics'}; for n = 1:6 xlswrite('Shortlist Outputs.xls', OutputMtx(:,:,n), xlssheetnames(n), 'F26:J60'); end When I try to run this code, I get the following error message: "??? Error using ==> xlswrite at 156 Sheet argument must be a string or a whole number greater than 0." Could someone help me with why it doesn't recognise the sheet name I've passed in as a string, and how to fix it? Thanks.
From: ImageAnalyst on 9 Jun 2010 22:36 Try xlssheetnames{n} (braces instead of parentheses) and see if that works.
From: TideMan on 9 Jun 2010 22:37 On Jun 10, 2:05 pm, "William " <billyte...(a)yahoo.com> wrote: > I've been having a little difficulty with an xlswrite command, and was hoping someone could help. I have the following code: > > xlssheetnames={'AllYrStatistics'; '7YrStatistics'; '5YrStatistics'; '3YrStatistics'; '2YrStatistics'; '1YrStatistics'}; > for n = 1:6 > xlswrite('Shortlist Outputs.xls', OutputMtx(:,:,n), xlssheetnames(n), 'F26:J60'); > end > > When I try to run this code, I get the following error message: > "??? Error using ==> xlswrite at 156 > Sheet argument must be a string or a whole number greater than 0." > > Could someone help me with why it doesn't recognise the sheet name I've passed in as a string, and how to fix it? Thanks. Use curly brackets, not parentheses: xlssheetnames{n}
From: William on 9 Jun 2010 23:50 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <9f607b32-3772-413b-9ca3-c60a850804da(a)i28g2000yqa.googlegroups.com>... > Try xlssheetnames{n} (braces instead of parentheses) and see if that > works. That did it, thanks very much for your help.
|
Pages: 1 Prev: Reading .mat filenames into a listbox Next: contour not plotting the correct values |