필터 지우기
필터 지우기

I would like to randomly mixed rows from Excel through MATLAB

조회 수: 2 (최근 30일)
Franck paulin Ludovig pehn Mayo
Franck paulin Ludovig pehn Mayo 2022년 4월 20일
댓글: Voss 2022년 4월 20일
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개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by