Error: Index exceeds matrix dimensions.

5 Ansichten (letzte 30 Tage)
Cody Baumann
Cody Baumann am 2 Apr. 2015
Beantwortet: Star Strider am 3 Apr. 2015
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 Kommentare
Cody Baumann
Cody Baumann am 3 Apr. 2015
help*
Cody Baumann
Cody Baumann am 3 Apr. 2015
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 .

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 3 Apr. 2015
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.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by