How do i resize a large dataset

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

Antworten (2)

Image Analyst
Image Analyst am 11 Mai 2020

0 Stimmen

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 Kommentare

Image Analyst
Image Analyst am 11 Mai 2020
By the way, 300 x 14 is hardly "large" - it's microscopic.
The breadwinner
The breadwinner am 12 Mai 2020
now all my numbers are rounded to integer values when the original data was all to 3 d.p . is there any way to get rid of this.
thanks
Walter Roberson
Walter Roberson am 12 Mai 2020
textscan with '%f' instead of '%d'
Image Analyst
Image Analyst am 12 Mai 2020
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.

Melden Sie sich an, um zu kommentieren.

A. Ragab
A. Ragab am 11 Okt. 2021

0 Stimmen

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

Kategorien

Mehr zu Large Files and Big Data finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 11 Mai 2020

Kommentiert:

am 11 Okt. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by