elseif rep.rateoptions == "Allow multirate processing" rows, cols = size(inputsignal)…
- User
elseif rep.rate_options == "Allow multirate processing" rows, cols = size(input_signal) new_rows = rows * rep.repetition_count buffer_matrix = zeros(new_rows, cols) * 1.0 for i in 1:rows for j in 1:rep.repetition_count buffer_matrix[(i-1)*rep.repetition_count+j, :] = input_signal[i, :] end end num_rows, num_cols = size(buffer_matrix) sub_matrices = Matrix{eltype(input_signal)}[] num_sub_matrices = ceil(Int, num_rows / rep.repetition_count) for i in 1:num_sub_matrices start_index = (i - 1) * rep.repetition_count + 1 end_index = min(i * rep.repetition_count, num_rows) sub_matrix = buffer_matrix[start_index:end_index, :] push!(sub_matrices, sub_matrix) end return sub_matrices end этот код работает, но нужно, чтобы он выводил массив из матриц, той же размерности, что и матрица, записанная в переменной input_signal
- Assistant
elseif rep.rate_options == "Allow multirate processing" rows, cols = size(input_signal) new_rows = rows * rep.repetition_count buffer_matrix = zeros(new_rows, cols) * 1.0 for i in 1:rows for j in 1:rep.repetition_count buffer_matrix[(i-1)*rep.repetition_count+j, :] = input_signal[i, :] end end num_rows, num_cols = size(buffer_matrix) sub_matrices = Matrix{eltype(input_signal)}[] num_sub_matrices = ceil(Int, num_rows / rep.repetition_count) for i in 1:num_sub_matrices start_index = (i - 1) * rep.repetition_count + 1 end_index = min(i * rep.repetition_count, num_rows) sub_matrix = buffer_matrix[start_index:end_index, :] push!(sub_matrices, sub_matrix) end return sub_matrices end However, I'm not sure what you mean by "output an array of matrices of the same dimension as the matrix stored in the variable input_signal." The current code already creates sub_matrices that have the same number of columns as input_signal but a different number of rows due to the repetition count. Could you provide more details on what you mean by the desired output?
- User
[[1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4], [5 6 7 8; 5 6 7 8; 5 6 7 8; 5 6 7 8], [9 10 11 12; 9 10 11 12; 9 10 11 12; 9 10 11 12]] это выход этого кода
- Assistant
To achieve the desired output, you can modify the code as follows:
julia