Hi,
I am doing some operation with for loop. The result of each iteration, let's say F1 needs to be svaed in the big matrix G as shown below.
for i = 1:1:10
G (:,:,i) = F1
end
However, the size of the matrix F1 varies for each iteration, owing to this I am getting the following error, Any idea how to handle this
Unable to perform assignment because the size of the left side is 1-by-1444 and the size of the right side is 1-by-1225.

 채택된 답변

KSSV
KSSV 2021년 6월 3일
편집: KSSV 2021년 6월 3일

0 개 추천

When the size of matrix varies, the option to save the matrix is a cell array.
G = cell(10,1) ;
for i = 1:1:10
G{i} = F1 ;
end
Later you can access the matrices using cell indexing. G{1}, G{2},....G{10}

댓글 수: 3

Big Data
Big Data 2021년 6월 3일
Thanks a lot.. !!!!!!!!!!
Now, I can save the data
KSSV
KSSV 2021년 6월 3일
Thanks is accepting/ voting the answer. :)
Big Data
Big Data 2021년 6월 3일
Sorry.. Forgot to do.. Done now..
Cheers !!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 6월 3일

댓글:

2021년 6월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by