Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to iterate creating matrices that are not altered by previous results?

조회 수: 2 (최근 30일)
CARLOS ALBERTO VIVAS BUSTOS
CARLOS ALBERTO VIVAS BUSTOS 2016년 10월 4일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi guys. Im new using matlab and I´m trying to do a sort of iteration process, from a matrix I have in a excel sheet. I want to put a Nan in every cell one by one and as a result finding the mean of the whole matrix, the code im usin is: for i=1:12; for j=1:26; w(i,j)=NaN w(isnan(w))=0 promannnnn(i,j)=mean(mean(w)) y{i,j} = promannnnn; end end
The previous code kind of do the job but every iteration is being affected by the one done before, and that is not what i want, hope somebody could aid me
thanks
  댓글 수: 1
KSSV
KSSV 2016년 10월 4일
Your code is not clear.. You are making w(i,j) NaN ..and replacing nan's with zeros..you have not initialized w and y.

답변 (1개)

Gareth Thomas
Gareth Thomas 2016년 10월 4일
I am not sure if I understand your questions but using:
you can actually omitnan
A = [1 0 0 1 NaN 1 NaN 0];
M = mean(A,'omitnan')
Does this help you?

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by