How can i visualize an exact column or row only of a matrix?

조회 수: 1 (최근 30일)
Elias Unk
Elias Unk 2017년 7월 22일
댓글: Elias Unk 2017년 7월 23일
let's say i have a 50 by 70 matrix and i want all the values of the column number 29, how can i do that.

채택된 답변

Image Analyst
Image Analyst 2017년 7월 22일
Extract from .mat file, then call plot. Try this:
storedStructure = load('features.mat');
myMatrix = storedStructure.B; % Extract matrix from the "B" field of the structure.
plot(myMatrix(:,29), 'b-', 'LineWidth', 2);
  댓글 수: 2
Elias Unk
Elias Unk 2017년 7월 22일
편집: Walter Roberson 2017년 7월 22일
i did get the following error:
Error using plot
Invalid first data argument
Image Analyst
Image Analyst 2017년 7월 22일
Please attach your .mat file (third request).

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 7월 22일
plot( YourMatrix(:,29) )
  댓글 수: 16
Image Analyst
Image Analyst 2017년 7월 23일
Just to expand on this for something you might want to know about some day, if you use
storedStructure = load('features.mat')
it reads in all the variables you stored as fields of storedStructure. So if you have stored A, B, and C, you'd have storedStructure.A, storedStructure.B, and storedStructure.C. Now if you wanted to pull out just one of those (which probably won't make any speed difference unless they were huge), you could ask load() to load just one from the file. For example:
storedStructure = load('features.mat', 'B');
Now storedStructure will have only a B field, not an A and C field. You could also extract the variable into its own B variable, if you want, like this:
B = storedStructure.B;
Just an FYI.
Elias Unk
Elias Unk 2017년 7월 23일
Cheers Walter,very helpful

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by