Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
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 Kommentare
Peter Perkins
Peter Perkins am 21 Feb. 2018
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 am 22 Feb. 2018
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Are Mjaavatten
Are Mjaavatten am 20 Feb. 2018
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

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by