I would like to randomly mixed rows from Excel through MATLAB

2 visualizaciones (últimos 30 días)
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 = [];

Respuesta aceptada

Voss
Voss el 20 de Abr. de 2022
Editada: Voss el 20 de Abr. de 2022
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 = [];

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by