Hello, i have the following code but whenever i run it, it returns an error that " Error using xlswrite (line 207) Invalid data range: ."
Show older comments
for ii=1:size(ug_waterthickness_deficits,3);
xlswrite('GRACE2_UG.xls', ug_waterthickness_deficits(:,:,ii),['month_' num2str(ii)]);
end
1 Comment
muhammad komugabe
on 19 Jun 2017
Accepted Answer
More Answers (2)
Image Analyst
on 17 Jun 2017
Edited: Image Analyst
on 17 Jun 2017
It works fine. I just tried it:
ug_waterthickness_deficits = rand(4,5,6);
for ii=1:size(ug_waterthickness_deficits,3)
xlswrite('GRACE2_UG.xls', ug_waterthickness_deficits(:,:,ii),['month_' num2str(ii)]);
end
In your code, you may have left out a comma or added an extra one. For some reason it thinks ['month_' num2str(ii)] is not the sheet name, but thinks it's the cell reference instead. Please post your ACTUAL code along with ALL the red text.
5 Comments
muhammad komugabe
on 19 Jun 2017
Edited: Walter Roberson
on 19 Jun 2017
Image Analyst
on 19 Jun 2017
That is not the complete error message. You snipped out a small, and useless, part of it. Please post ALL the red text.
muhammad komugabe
on 20 Jun 2017
Image Analyst
on 20 Jun 2017
What does this show
>> which -all repmat
Jan
on 20 Jun 2017
@muhammad komugabe: It seems like you have created a file called "repmat.m", but this collides with Matlab's built-in function.
The message "Undefined function or variable 'Ug_waterthickness'" is clear also. Perhaps you want a lower-case 'u'?
Please take the time to read the error messages by your own.
muhammad komugabe
on 6 Sep 2017
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!