Filter löschen
Filter löschen

I need to make a table out of a large matrix. Help?

1 Ansicht (letzte 30 Tage)
Aaron Zorzi
Aaron Zorzi am 18 Feb. 2016
Kommentiert: Aaron Zorzi am 18 Feb. 2016
I have a 280x3 matrix of values, and I need to make a table out of 10 points from them that fall between the rows that include -10 and 10, which are the 21st and 221st rows, respectively. My teacher gave us this hint:
Hint: Once you know which row has the -10 and 10 AA Temp degree you can use floor(linspace(r1,r2,N)) where r1 = the row with -10 and r2 = the row with 10. This will give you the row locations for N points which span the range are not quite equally spaced but close. Use these locations to get your AA Tire temperatures and the deflection values.
However, I am trying to use this command and it is not working. I'm getting really frustrated; all I'm trying to do is make a table. Please help?
M = xlsread('tire_lab');
T = floor(linspace(M(21,:),M(221,:),10))
  2 Kommentare
John BG
John BG am 18 Feb. 2016
hang the Excel file so the readers can have a look

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 18 Feb. 2016
Either use a loop to linspace row by row, or substitute equivalent logic without linspace.
linspace(r1, r2, 10)
for row vectors r1 and r2 to be taken as pairs, can be calculated as
LS = (repmat(r1,10,1) + bsxfun(@times, (0:9).'/10, (r2-r1))).';
This will give you a length(r1) by 10 array ready to be further processed.
  2 Kommentare
Walter Roberson
Walter Roberson am 18 Feb. 2016
I would note, by the way, that the problem description is almost certainly talking about row numbers r1 and r2, rather than row contents
Aaron Zorzi
Aaron Zorzi am 18 Feb. 2016
When I try to do linspace(r1,r2,10) it tells me that the matrix dimensions don't agree and won't allow me to do anything else. What's wrong with it?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by