MATLAB Answers


substitute one cell of 3D matrix with another cell

Asked by talayeh ghodsi on 26 May 2019
Latest activity Commented on by talayeh ghodsi on 26 May 2019
Hi every body.
I have a 512*512*368 matrix which consist of 368 images of size 512*512. I want to delet the 158th image in the matrix and replace it with another image which is 2D image and the same size az 512*512. Could you please tell me how can i do it?


Sign in to comment.

1 Answer

Answer by Stephan
on 26 May 2019
Edited by Stephan
on 26 May 2019
 Accepted Answer

A(:,:,158) = I; % where I is the 512x512 image you want to insert


Show 1 older comment
Thanks a lot sir. but what should I do whit this error?
Error: Incorrect use of '=' operator. To assign a value to a variable,
use '='. To compare values for equality, use '=='.
This message should not appear, if things are fine - see this simple example:
I = [1 3; 2 4]
A = zeros(2,2,4)
A(:,:,3) = I
Thanks a lot, it works

Sign in to comment.