MATLAB Answers

Subscripted assignment dimension mismatch

2 views (last 30 days)
Tracy Campbell
Tracy Campbell on 10 Aug 2017
LULCmaster = zeros(180,296,85);
for scen=1:1
if scen == 1;
scStr = '10_B_10';
for yr=1986:2013
yearStr = num2str(yr);
LULCmaster(:,:,yr-1985) = ascii2ncIBIS([s1 yearStr s2]);
for yr=2014:2070
yearStr = num2str(yr);
LULCmaster(:,:,yr-1985) = ascii2ncIBIS([s1 scStr '_' yearStr s3]);
The errors occurs in the following line:
LULCmaster(:,:,yr-1985) = ascii2ncIBIS([s1 yearStr s2]);
  1 Comment
kowshik Thopalli
kowshik Thopalli on 11 Aug 2017
What are the dimensions of s1 and s2. What exactly does this function do ascii2ncIBIS?

Sign in to comment.

Answers (1)

Sangeetha Jayaprakash
Sangeetha Jayaprakash on 14 Aug 2017
This error is most likely because you are attempting to assign elements to an existing array, but the size of the variable you are trying to assign may not be compatible with the existing array i.e. The size of "LULCmaster" may not be compatible to what "ascii2ncIBIS" function is returning.

Community Treasure Hunt

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

Start Hunting!