% Define the matrices A, B, and C
A = [3 -2 1; 6 8 -5; 7 9 10];
B = [6 9 -4; 7 5 3; -8 2 1];
C = [-7 -5 2; 10 6 1; 3 -9 8];
% Create a 3D array D where each matrix is a layer
D = cat(3, A, B, C);
% Find the largest element in each layer
max_A = max(A(:)); % Max of the first layer (A)
max_B = max(B(:)); % Max of the second layer (B)
max_C = max(C(:)); % Max of the third layer (C)
% Find the largest element in the entire array D
max_D = max(D(:));
% Display the results
fprintf('Largest element in matrix A: %d\n', max_A
); fprintf('Largest element in matrix B: %d\n', max_B
); fprintf('Largest element in matrix C: %d\n', max_C
); fprintf('Largest element in the entire array D: %d\n', max_D
);
JSBEZWZpbmUgdGhlIG1hdHJpY2VzIEEsIEIsIGFuZCBDCkEgPSBbMyAtMiAxOyA2IDggLTU7IDcgOSAxMF07CkIgPSBbNiA5IC00OyA3IDUgMzsgLTggMiAxXTsKQyA9IFstNyAtNSAyOyAxMCA2IDE7IDMgLTkgOF07CgolIENyZWF0ZSBhIDNEIGFycmF5IEQgd2hlcmUgZWFjaCBtYXRyaXggaXMgYSBsYXllcgpEID0gY2F0KDMsIEEsIEIsIEMpOwoKJSBGaW5kIHRoZSBsYXJnZXN0IGVsZW1lbnQgaW4gZWFjaCBsYXllcgptYXhfQSA9IG1heChBKDopKTsgICUgTWF4IG9mIHRoZSBmaXJzdCBsYXllciAoQSkKbWF4X0IgPSBtYXgoQig6KSk7ICAlIE1heCBvZiB0aGUgc2Vjb25kIGxheWVyIChCKQptYXhfQyA9IG1heChDKDopKTsgICUgTWF4IG9mIHRoZSB0aGlyZCBsYXllciAoQykKCiUgRmluZCB0aGUgbGFyZ2VzdCBlbGVtZW50IGluIHRoZSBlbnRpcmUgYXJyYXkgRAptYXhfRCA9IG1heChEKDopKTsKCiUgRGlzcGxheSB0aGUgcmVzdWx0cwpmcHJpbnRmKCdMYXJnZXN0IGVsZW1lbnQgaW4gbWF0cml4IEE6ICVkXG4nLCBtYXhfQSk7CmZwcmludGYoJ0xhcmdlc3QgZWxlbWVudCBpbiBtYXRyaXggQjogJWRcbicsIG1heF9CKTsKZnByaW50ZignTGFyZ2VzdCBlbGVtZW50IGluIG1hdHJpeCBDOiAlZFxuJywgbWF4X0MpOwpmcHJpbnRmKCdMYXJnZXN0IGVsZW1lbnQgaW4gdGhlIGVudGlyZSBhcnJheSBEOiAlZFxuJywgbWF4X0QpOwo=