Easily working with numerical data in a cell array

조회 수: 6 (최근 30일)
Kirby Runyon
Kirby Runyon 2015년 9월 1일
댓글: Star Strider 2015년 9월 1일
I have a bunch of n x 2 matrices stored in a 1 x 37 cell array. The first column of each matrix is an x-position and the 2nd column is a y-position. How do I a) plot all the data as y vs. x; and b) how do I concatenate this into one long n x 2 matrix? My horrible workaround has been to use
celldisp
and then to copy and paste this into Excel!

채택된 답변

Thorsten
Thorsten 2015년 9월 1일
A{1} = rand(12,2);
A{2} = rand(10,2);
b)
B = cell2mat(A');
a)
plot(B(:,1), B(:,2))
  댓글 수: 2
Kirby Runyon
Kirby Runyon 2015년 9월 1일
Thanks, but is there a way to do this for all 37 entries in my cell array without having to manually call each cell individually?
Star Strider
Star Strider 2015년 9월 1일
The ‘B’ assignment does just that.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by