how to multiply a number to matrix?

1 回表示 (過去 30 日間)
Aarti Soni
Aarti Soni 2022 年 7 月 18 日
コメント済み: Bruno Luong 2022 年 10 月 15 日
Hello everyone,
I have a matrix 180X360X1332 (Latitude X Longitude X Time). I want to multiply 30 at every fourth number of third demension (e.g., 1,5,9,13......1332)
I have tried this for vector data:
Y = 30*(1:4:1332);
How can I do this for matrix data?
Thanks
  3 件のコメント
Aarti Soni
Aarti Soni 2022 年 7 月 18 日
@Bruno Luong I have updated my question. Hope this is clear now.
Bruno Luong
Bruno Luong 2022 年 7 月 18 日
If that is the case, see @vishweshwar samba answer

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

採用された回答

vishweshwar samba
vishweshwar samba 2022 年 7 月 18 日
編集済み: vishweshwar samba 2022 年 7 月 18 日
I assume that the matrix 180X360X1332 (Latitude X Longitude X Time) is a multidimentional array and you want to multiply a value of 30 to (Latitude X Longitude) in the interval of 4 wrt Time.
% By using the below for loop, created a matrix 'A' of dimension 180x360x1332 (Latitude X Longitude X Time)
for i = 1:1332
A(:,:,i) = ones(180,360);
end
% Now multiply a number 30 in time dimension at interval of 4(1:4:1332)
A(:,:,1:4:1332) = A(:,:,1:4:1332)*30;
  8 件のコメント
Aarti Soni
Aarti Soni 2022 年 10 月 14 日
I have one more question in this regard, suppose, I have a time series (1x48) and I want to extract values at particular interval. Means, I want to creat a new time series which will have only 12 values. e.g., 1,5,9,13,17, 21, 25, 29, 33, 37, 41, 45
How can I do this?
Thanks
Bruno Luong
Bruno Luong 2022 年 10 月 15 日
@Aarti Soni I suggest you to create a new thread and better description. Someone else can answer to you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by