indices on left not compatible with size of the right

1 view (last 30 days)
Dear Community, I am hoping somebody can advice on the error below that I keep hitting with a new code:
Unable to perform assignment because the indices on the left side are not
compatible with the size of the right side.
Error in ms_manip (line 38)
[~, pol_lat(i), pol_lon(i)] = mf_srex(lat_mod, lon_mod, PRECT_ctl, area, island, [], srex_reg{i}); %#ok<*SAGROW>
Here is the full code the error refers to:
% get grid dimensions
[nlat, nlon] = size(lat_mod);
% get number of srex regions
nreg = length(srex_reg);
% get land pixel indices - excluding Antarctica
island = pct_land > 50;
island(lat_mod < -60) = 0; % remove antarctica
% get land pixel indices - excluding Antarctica
isirr = pct_irr > 10;
isirr(lat_mod < -60) = 0; % remove antarctica
% create date vectors
date_vec = datevec(datenum(time_begin):1:datenum(time_end));
% get corners of SREX regions used in this study and use them to generate srex masks
for i=1:nreg
[~, pol_lat(i), pol_lon(i)] = mf_srex(lat_mod, lon_mod, PRECT_ctl, area, island, [], srex_reg{i}); %#ok<*SAGROW>
issrex(:,:,i) = inpolygon(lon_mod, lat_mod, pol_lon{i}, pol_lat{i}) & island;
end
The above code was working previously before the variable 'area' was added - but the code (with the new variable) is working fine elsewhere. The units also seem fine. Please help
  2 Comments
madhan ravi
madhan ravi on 23 Oct 2018
Upload your code I mean everything with all the input datas , saves time

Sign in to comment.

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!