How to display this whole data simultaneously?
이전 댓글 표시
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]
답변 (1개)
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
Sadiq Akbar
2024년 3월 3일
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
2024년 3월 3일
Voss
2024년 3월 3일
"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
2024년 3월 3일
편집: Sadiq Akbar
2024년 3월 3일
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
2024년 3월 4일
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
