Error: Index exceeds matrix dimensions.

조회 수: 2 (최근 30일)
Cody Baumann
Cody Baumann 2015년 4월 2일
답변: Star Strider 2015년 4월 3일
clear
clc
[num,txt]=xlsread('tire_ratings.xls');
ratings=num(:,1);
speed=num(:,2);
vehicles =num(:,3);
text=txt(1,1:3);
TR=triangulation(ratings,speed,vehicles);
size(TR)
%This is the error/output
Index exceeds matrix dimensions.
Error in ENG1102_11C (line 9)
speed=num(:,2);
  댓글 수: 6
Cody Baumann
Cody Baumann 2015년 4월 3일
help*
Cody Baumann
Cody Baumann 2015년 4월 3일
Load the values into a number vector called speed and a text matrix called txt . Use the size command to determine how many rows are in the text matrix. Extract all tire ratings and store them in a vector called ratings . Extract all vehicle types and store them in a vector called vehicles .

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2015년 4월 3일
This works:
ratings=num(:,1);
speed=txt(:,1);
vehicles =txt(:,3);
The ‘num’ variable has one column, ‘txt’ has three, only 1 and 3 with any information.

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by