How to convert excel column data into an array in MATLAB
조회 수: 18 (최근 30일)
이전 댓글 표시
I have experimental data, I need to plot the data into arrays in matab code. In the data there is data points for Time, Load, and Displacement. I need to make three arrays to represent data point. I have attached the excell sheet Any help will be great thank you!!!
댓글 수: 0
채택된 답변
Voss
2022년 3월 24일
It's really very fine and good to keep all your data in a matrix (called data, say), in this case with three columns, so that when you need Time you say data(:,1), when you need Load you say data(:,2), etc., but if you want three separate variables, you can do that too:
data = readmatrix('Test1.csv')
Time = data(:,1);
Load = data(:,2);
Displacement = data(:,3);
% plot Load and Displacement vs Time:
% plot(Time,[Load Displacement]) % same as below
plot(data(:,1),data(:,[2 3]));
legend('Load','Displacement');
xlabel('Time');
댓글 수: 2
Voss
2022년 3월 24일
You're welcome!
If you have any questions, please let me know. If not, and if this answer works for you, please mark it as 'Accepted'. Thanks!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
