I need to make a table out of a large matrix. Help?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2016년 2월 18일
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
Walter Roberson
2016년 2월 18일
I would note, by the way, that the problem description is almost certainly talking about row numbers r1 and r2, rather than row contents
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!