フィルターのクリア

Read data using xlsread and store in a variable

1 回表示 (過去 30 日間)
Muhammad Usman
Muhammad Usman 2015 年 3 月 20 日
回答済み: XueJing Yu 2015 年 3 月 20 日
Hi I have an Excel file with 1000 rows and i want to pick 30 random rows from it, i used xlsread command to read the excel data in for loop, i want to save all the rows read from the file but the issue i am facing is that when i save in a MAT file (using save command) i just only the last row that overwrites all other rows. please answer quickly,i am very thankful

採用された回答

XueJing Yu
XueJing Yu 2015 年 3 月 20 日
Maybe you can read all data and then select rows using function "resample".
data = xlsread(yourFileNameHere);
nTotalRows = 30;
nSelection = 10;
selectedRowIndex = datasample(1:1:nTotalRows,nSelection,'Replace',false);
dataSelection = data(selectedRowIndex,:);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by