why do i receive "Unable to perform assignment because brace indexing is not supported for variables of this type".

2 次查看(过去 30 天)
dear matlab community, i try to get the dmos value with 982x2 where the column 1 is the size of image and the second collumn 2 is for the dmos value but there is a problem with coding. can see the attach file. i appreciate all your help. thank you

回答(1 个)

Voss
Voss 2023-5-27
Brace indexing (using {}) is for cell arrays (or tables), but FYPdatabase is a numeric array, so that's why the error happens.
Here's how you can make FYPdatabase a cell array, with first column being image size and second column being the corresponding element of dmos, as specified in your question:
load('dmos.mat');
FYPdatabase = cell(numel(dmos),2); % preallocate a cell array with 2 columns and numel(dmos) rows
FYPdatabase(:,2) = num2cell(dmos); % place the dmos values in the 2nd column

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by