How to display this whole data simultaneously?
Afficher commentaires plus anciens
When I run the following code, it displays the data in such a way that it shows the 1st 9 columns in one screen and the remaining 3 columns in other screen. I want to display the whole 12 columns in one screen. How can we do that?
clear;clc
s2=rand(100,1);
s3=rand(100,1);
s4=rand(100,1);
s21=rand(100,1);
s31=rand(100,1);
s41=rand(100,1);
s22=rand(100,1);
s32=rand(100,1);
s42=rand(100,1);
s23=rand(100,1);
s33=rand(100,1);
s43=rand(100,1);
format compact
S=[s2 s3 s4 s21 s31 s41 s22 s32 s42 s23 s33 s43]
Réponses (1)
John D'Errico
le 3 Mar 2024
Modifié(e) : John D'Errico
le 3 Mar 2024
What can you do? This will mainly be in your MATLAB settings, first, under the command window tab. Here, you can control how many columns the array will be displayed as. So turn off the item "Set matrix display width to eighty columns".
Next, make the command window font smaller. This is in the fonts tab for settings. I leave mine at 12 or even 14 point. Older eyes need bigger numbers. :) But you can go much smaller, and so fit much more into the window space you do have available.
Next, make your command window as wide as possible. Since I have a 27 inch display, that works nicely, so I can be a display hog. But if you have a small laptop, you have less capability there.
Use a short format for numeric display.
format short
x = rand(1,5)
Of course, this limits your ability to read the numbers if they vary by orders of magnitude.
And, finally, you can use a tool like sprintf to display the array, giving less space between numbers. That takes a little more effort on your part of course.
disp(sprintf('%0.4g ',x))
7 commentaires
Sadiq Akbar
le 3 Mar 2024
Here are a couple of other options:
1. Adjust the sprintf format:
disp(sprintf([repmat('%8.5f ',1,size(S,2)) '\n'],S.'))
2. Display as a table:
disp(array2table(S))
Sadiq Akbar
le 3 Mar 2024
Voss
le 3 Mar 2024
"I want to display them graphically such that each displayed graph tells me that this is the graph of s2, s3, s4, s21, s31, s41,
s22, s32, s42,
s23, s33, s43 etc."
I'm not sure what you're asking here. Use a legend? Maybe a legend with NumColumns=3?
"How can we do that using a semilogarithmic graph for vertical axis"
Use semilogy or set(gca(),'YScale','log').
"can we display them graphically in such way that all the graphs of s2,s3 and s4 are in one colour such that colour of s2 is dark, colour of s3 is the same colour but lighter than s2 and then colour of s4 is further lighter than s3. And thei same patern is also for the others i.e. s41 is lighter than s31 which is lighter than s21. Likewise, s42 is lighter than s32 which is lighter than s22 and so on."
Specify the colors when you plot them.
Sadiq Akbar
le 3 Mar 2024
Modifié(e) : Sadiq Akbar
le 3 Mar 2024
John D'Errico
le 3 Mar 2024
Modifié(e) : John D'Errico
le 3 Mar 2024
So what is the problem? Learn to specify the color of a segmented line. You can do that using the function line. And then you can plot the lines in any color you want. Multiple calls to line will plot on the same set of axes. You need not even use the hold command.
For example...
for r = 0:.1:1
line(sort(rand(1,5)),3*r + sort(rand(1,5)),'color',[r,.1,.3])
end
All you need to do now is learn how to control the colors using an RGB triple, so you need to understand the RGB color space.
Sadiq Akbar
le 4 Mar 2024
Catégories
En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
