I have a parameter as below; I want to set values from MATLAB array with dimensions H1(N_u,NV_T^2,N_B}. AS I checked setValues function only supports 2D. Can you please let me know how I can set the values of the parameter h_T_real from H1?
set MBS:={1…N_B};
set USERS := {1…N_u};
set Antenna_T :={1…NVH_T^2};
param h_T_real{USERS,Antenna_T,MBS};
What if you generate a list of indices and a list of values for your 3D matrix and then use the setValues(indices, values) approach?
% Get dims of your 3D matrix
[N_u, NV_T_sq, N_B] = size(H1);
% Create the indices and values lists
num_elements = N_u * NV_T_sq * N_B;
indices = cell(num_elements, 1);
values = zeros(num_elements, 1);
counter = 1;
for i = 1:N_u
for j = 1:NV_T_sq
for k = 1:N_B
indices{counter} = [i, j, k];
values(counter) = H1(i, j, k);
counter = counter + 1;
end
end
end
% Now you have two lists:
% 'indices' is a cell array containing the indices as 1x3 numeric arrays
% 'values' is a column vector containing the actual values