MATLAB: Brace indexing is not supported for variables of this type

errorMATLABvariable

Hey all, When I try to use this code:
output = cell(size(new_precipitation));
for i = 1:length(new_precipitation)
mn2t_mat = new_precipitation{i}; % extract matrix of ith element
yd = max(max(mn2t_mat)); % first find maximum for each hour
y = reshape(yd,24,1,size(yd,3)/24); % reshape it by day
output{i} = max(y); % find maximum of each day
end
This error appeared:
Brace indexing is not supported for variables of this type.
I was search for some answer but can't find how to fix it. Do you have any idea how to overcome this error?
I attached a new_precipitation.mat file in the google drive which has 10 MB in this link:
Thank you in advance
Caption:
I have a 3D matrix named new_precipitation (latitude x longitude x time). In essence time dimension is in the hourly time steps for a year (365-day x 24 hours = 8760). Whole data are for temperature and I want to find the maximum temperature for each day instead of hourly.
24 values for each day that represents temperature so I need to find a maximum of 24 values in order to have the maximum temperature of each day.
So I need to find maximum value for every 24 by 24-time steps and consider it for days.
I'm sorry I forgot to change the name so new_precipitation is a wrong variable name of new_temperature.

Best Answer

I think Walter was onto the right thing in his comment. new_precipitation is of type 'double' and so doesn't support brace (i.e. { } ) indexing. For that variable you'll want to change to ordinary round brackets (i.e. ( ) ). In other words, you'll need to change the third line to something like:
mn2t_mat = new_precipitation(i); % extract matrix of ith element