insert new rows and movin data into new rows

1 回表示 (過去 30 日間)
Takim Mustakim
Takim Mustakim 2022 年 4 月 16 日
コメント済み: Image Analyst 2022 年 4 月 17 日
clear all; clc;
n = 1000;
lambda = 480;
WAK = poissrnd(lambda,1,n);
WK(1) = WAK(1);
for i=1:n-1
WK(i+1) = WK(i) + WAK(i+1);
end
how to make WK multi-dimensional with : 1440*(t-1) <= WK(i) < 1440*t , suppose :
  • for t=1 , WK(i) on row 1
  • for t=2 , WK(i) on row 2
  • for t=3, WK(i) on row 3
  • dst.

採用された回答

Image Analyst
Image Analyst 2022 年 4 月 16 日
Hint:
Use repmat() to copy the 1-D WK into additional rows or columns.
but I'm not sure what it's asking because I don't know if t is rows or columns, and every row or column has the same value, which is just WK(i).
  6 件のコメント
Takim Mustakim
Takim Mustakim 2022 年 4 月 17 日
not like what a mean but thank you for your response
Image Analyst
Image Analyst 2022 年 4 月 17 日
It's literally the output matrix you said WK should become, element by element.
And you never answered my questions: "What's the use case? Why do you need to do this quirky thing anyway?"
That might help me figure out what is wanted.
Looking at the second half of your original question, the best I can figure out what you mean is to use
WK2 = reshape(WK, [], 1440);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by