How to extract values from tables in the workspace and then plot them in a specific way

조회 수: 7 (최근 30일)
Hi everyone,
I am a relatively inexperienced user of MATLAB, so sorry if this is an obvious question.
Problem:
I have 3 16x8 tables in the workspace. Tables represent recordings from different conditions of muscle, and values in the tables are forces at specific point in muscle.
For example: row 1 column 1 values of Table 1 and Table 2 and Table 3 represent force in the same place in a muscle, just with different conditions. These conditions affect the force value in one way or the other.
I would like to plot these points in this way: Y-axis would be the force values, and X-axis value will be "20" for values taken from Table1, "30" for values from Table2, and "40" for values from Table3. So my output should be 16*8=128 scatter plots with 3 points in each.
Questions:
1. My first question would be how to plot values in this way? How do I set specific x-axis values opposing each row/column value from the table?
2. Answer to question 1 would allow me to do all of this "by hand", but how do I automate plotting these 128 scatter plots?
Thanks a lot!
  댓글 수: 2
Peter Perkins
Peter Perkins 2018년 2월 21일
Vladislav, without meaning to tell you about your own data, this seems like a funny way to plot them. Have you considered making a 3-D scatter plot (force vs. x and y) with color to distinguish the three cases?
Or maybe 8 plots of force vs. X with symbols to distinguish the three cases?
Vladislav Mukhin
Vladislav Mukhin 2018년 2월 22일
Hi Peter,
Yeah it is a funny way, but I had to do it this way. No worries though, thanks to Are’s response I managed to figure it out! Thanks for your advice.

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

채택된 답변

Are Mjaavatten
Are Mjaavatten 2018년 2월 20일
Is this what you want?
x = [20,30,40];
for i = 1:16;
for j = 1:8;
figure;
plot(x,[Table1(i,j),Table2(i,j),Table3(i,j)],'*');
title(sprintf('i = %d, j = %d',i,j));
end
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by