wav dimentions are
wav = 5001*1
and I want to change it as wav = 5001*5
How I can reshape it?

 採用された回答

Steven Lord
Steven Lord 2020 年 10 月 28 日

1 投票

So you want to take 5001 values and generate 25005 (5001 times 5) values using those values. How do you want to generate the additional 20004 values?
Make duplicate copies?
x = (1:6).'
y = repmat(x, 1, 5)
Offset the copies by a certain amount? This approach uses implicit expansion; if you're using an older release you could use bsxfun.
x = (1:6).'
y = x + (0:10:40)
Pad with 0 values or with random data?
x = (1:6).'
y = [x, zeros(size(x, 1), 5)]
z = [x, rand(size(x, 1), 5)]
w = [x, randi([7 11], size(x, 1), 5)]
Something else? If so, please explain in detail how you want to generate the additional values.

3 件のコメント

Nisar Ahmed
Nisar Ahmed 2020 年 10 月 28 日
I want to generate duplicate values (5000) in five columns rather than one...
Elijah McNeil
Elijah McNeil 2020 年 10 月 28 日
His code does that, Just write this.
x = (1:5000).';
wav = repmat(x, 1, 5).
Nisar Ahmed
Nisar Ahmed 2020 年 10 月 28 日
Elijah McNeil, thanks dear, Now it is working

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

その他の回答 (1 件)

Elijah McNeil
Elijah McNeil 2020 年 10 月 28 日
編集済み: Elijah McNeil 2020 年 10 月 28 日

0 投票

This should work
wav = 5001*1
wav = wav*5

5 件のコメント

Nisar Ahmed
Nisar Ahmed 2020 年 10 月 28 日
In wav, it is one column matrix and I want to convert it into 5 column matrix...
Elijah McNeil
Elijah McNeil 2020 年 10 月 28 日
編集済み: Elijah McNeil 2020 年 10 月 28 日
OK, you can't do that unless wav has 5 values. Example:
wav = [5000; 6000;7000; 8000; 9000] % that equals 1 column and 5 rows
wav = wav' % that creates 5 columns and 1 row
reshape(wav,1,5) % this also creates 5 columns and 1 row
Nisar Ahmed
Nisar Ahmed 2020 年 10 月 28 日
It is not working, perhaps I'm unable to explain my point...
the size of wav is 5000 1 and I want reshap it as 5000 5
Elijah McNeil
Elijah McNeil 2020 年 10 月 28 日
Wait 5000 rows and 1 column?
Nisar Ahmed
Nisar Ahmed 2020 年 10 月 28 日
5000 rows and 5 columns, each column is duplicate of other.

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

質問済み:

2020 年 10 月 28 日

コメント済み:

2020 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by