Changing the dimensions of a variable.

3 ビュー (過去 30 日間)
Alexandra Ridgway
Alexandra Ridgway 2017 年 2 月 12 日
コメント済み: Alexandra Ridgway 2017 年 2 月 12 日
Hi,
Fe68 has dimensions 151x31. AnomFe68, once I've done the following, has dimensions 1x4429. I want it to have the same dimensions as Fe68 but replacing the numbers with 1/0 as directed. I believe if I achieve this then the line 'finalFe68 = anomFe68*dz(:)*dlong' will stop giving me the error 'inner matrix dimensions must agree'?
Please advise.
dlong = 109079.92
anomFe68(Fe68<=0)=0
anomFe68(Fe68>0)=1
for j=2:31
dz(j)=abs(depth(j)-depth(j-1))
end
finalFe68 = anomFe68*dz(:)*dlong
sum(final68)
Thank you,
Alexandra

回答 (1 件)

Jan
Jan 2017 年 2 月 12 日
編集済み: Jan 2017 年 2 月 12 日
Perhaps you want:
anomFe68 = double(Fe68 > 0);
Note that this treats the line "anomFe68(Fe>0)=1" as it is "anomFe68(Fe68>0)=1" .
  1 件のコメント
Alexandra Ridgway
Alexandra Ridgway 2017 年 2 月 12 日
Hi, in my original script both lines should have been anomFe68(Fe 68>0)...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by