How to save multiple 2D arrays in a third dimension in simulink?
조회 수: 12 (최근 30일)
이전 댓글 표시
I will be reading multiple 2D arrays of the same size (100, 8) in time. The idea is to concatenate all of them in a 3D array.
How can implement this in simulink?
댓글 수: 3
답변 (1개)
Samatha Aleti
2020년 4월 30일
Hi,
You can accordingly place a condition for concatenating each 2D array to a 3D array. Here is a sample code(modified code of Sindar's):
N = 10; % Let Num of 2D arrays
my3Darray=zeros(100,8,N);
for ind=1:10
my2Darray = randi(50,100,8);
my3Darray(:,:,ind) = my2Darray;
% check for "1" in last column and remove concatenation of 2D array if there is no "1"
if all(my2Darray(:,end) ~= 1)
my3Darray(:,:,ind) = [];
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!