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

4 次查看(过去 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 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by