Hi Nadia
Unfortunately, you cannot directly modify the weights of an autoencoder in MATLAB. The 'EncoderWeights' property is read-only, which means you cannot change its values. However, you can train a new autoencoder with the desired weights by specifying the 'EncoderWeights' option during training.
Here's an example:
% Create and train an autoencoder
autoenc = trainAutoencoder(X, hiddenSize);
% Modify the weights
newWeights = ones(size(autoenc.EncoderWeights)); % Set all weights to 1
% Train a new autoencoder with the modified weights
newAutoenc = trainAutoencoder(X, hiddenSize, 'EncoderWeights', newWeights);
Adding MATLAB documentation, for your reference: