Hi all,
please I want to Know why the P variable does not included in the p nan matrix like other variable this is the code:
t=ones(30,41)*nan;
sal=ones(30,41)*nan;
Z=ones(30,41)*nan;
p=ones(30,41)*nan;
for i=1:41
ncload(['wod_00',num2str(cast(i)),'O.nc']);
% pause
[n,m]=size(Temperature);
if (~exist('Pressure'))
t(1:n,i)=Temperature(:);
Z(1:n,i)=z(:);
else
t(1:n,i)=Temperature(:);
Z(1:n,i)=z(:);
sal(1:n,i)=Salinity(:);
if lat>20
exist('Salinity', 'var')
sal(1:n,i)=Salinity(:);
exist('Pressure','var');
p(1:n,i)=Pressure(:);
end
end
end
THANK YOU FOR WHOM WHO HELP me :(

댓글 수: 6

per isakson
per isakson 2014년 4월 6일
t=ones(30,41)*nan; may be replaced by t=nan(30,41);
Jan
Jan 2014년 4월 6일
I do not see a variable called "P".
nan(30,41) is nicer than ones(30,41)*nan.
The exist('Salinity', 'var') line does not have any effects.
lina
lina 2014년 4월 6일
편집: lina 2014년 4월 6일
per isakson and Jan simon Thank you VERY MUCH!
dpb
dpb 2014년 4월 6일
The above loop could be streamlined as...
for i=1:41
ncload(['wod_00',num2str(cast(i)),'O.nc']);
[n,m]=size(Temperature);
t(1:n,i)=Temperature(:);
Z(1:n,i)=z(:);
if exist('Pressure')
sal(1:n,i)=Salinity(:);
if lat>20
sal(1:n,i)=Salinity(:);
p(1:n,i)=Pressure(:);
end
end
end
since the t and z variables are stored either way, don't need the else clause at all...
Jan
Jan 2014년 4월 6일
@lina: You are welcome. Could you clarify what this means:
the P variable does not included in the p nan matrix
lina
lina 2014년 4월 7일
편집: lina 2014년 4월 7일
mr. simon I just solve the problem after ur correction above. thank you
dpd the loop is work

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 NaNs에 대해 자세히 알아보기

태그

질문:

2014년 4월 6일

편집:

2014년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by