I would like to randomly mixed rows from Excel through MATLAB

5 次查看(过去 30 天)
I am reading data from excel through MATLAB. I would like that each time i run the script , i get my rows to be randoms. But i don't Know how to proceed.
To be more specific, For instance, i would like that when running the script for the first time, my first row could be my 5th row or 15 th row and so on
data = xlsread('excel_data.xlsx');
handles.v_thickness_1 = data(:,1);
handles.v_thickness_2 = data(:,2);
handles.h_thickness_1 = data(:,3);
handles.h_thickness_2 = data(:,4);
handles.v_or_h_array = data(:,6);
handles.exp_counter = 1;
handles.region1 = [];

采纳的回答

Voss
Voss 2022-4-20
编辑:Voss 2022-4-20
data = xlsread('excel_data.xlsx');
% randomly permute the rows of data:
data = data(randperm(size(data,1)),:);
handles.v_thickness_1 = data(:,1);
handles.v_thickness_2 = data(:,2);
handles.h_thickness_1 = data(:,3);
handles.h_thickness_2 = data(:,4);
handles.v_or_h_array = data(:,6);
handles.exp_counter = 1;
handles.region1 = [];

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by