How do i resize a large dataset

3 ビュー (過去 30 日間)
The breadwinner
The breadwinner 2020 年 5 月 11 日
コメント済み: Walter Roberson 2021 年 10 月 11 日
I am trying to copy and paste a dataset from the internet and resize it into a matrix (300x14) however when copying the dataset it appears in the form below
1 2 3 4 5 6 6 7 8 8 8 9
2 2
3 2 3 4 5 6 7 7 8 6 4 3
1 3 ...
how do i resize this without applying semicolons on every other row?
Thanks

回答 (2 件)

Image Analyst
Image Analyst 2020 年 5 月 11 日
You could paste it into a txt file then create the matrix with this code:
fid = fopen('text.txt'); % Open the text file.
numbers = textscan(fid, '%d');
numbers = reshape(numbers{1}, 14, [])'
fclose(fid);
  4 件のコメント
Walter Roberson
Walter Roberson 2020 年 5 月 12 日
textscan with '%f' instead of '%d'
Image Analyst
Image Analyst 2020 年 5 月 12 日
Walter's right. And this highlights the importance of attaching your data. The data you posted was integers so I used %d. If you had attached your text file we would have known you had floating point numbers and we would have gotten you the correct answer immediately.

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


A. Ragab
A. Ragab 2021 年 10 月 11 日
if i have large input data(hex),and i need to make fragmention in to small data each size 32 hex to be used as input of AES
  2 件のコメント
Image Analyst
Image Analyst 2021 年 10 月 11 日
Not sure how this is an Answer to @The breadwinner's question.

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

カテゴリ

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