Beantwortet
Check if button was pressed in Matlab AppDesigner
You've got button A and button B. When the user presses button B, you want different actions depending on whether button A wa...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to reduce edge thickness of trisurf plot?
h = trisurf(__); h.LineWidth = __

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do I change color of the segmented areas from an image?
Use the clim function. call clim without any inputs to see what the original colormap limits are. shift the clim upward (ass...

mehr als 3 Jahre vor | 0

Beantwortet
How can I plot points on top of a histogram's bins?
I think this is close to what you're looking for and will get you most of the way there. h = histogram(rand(1,5000)*100); %...

mehr als 3 Jahre vor | 1

| akzeptiert

Poll


How often is your MATLAB code officially or unofficially reviewed?

fast 4 Jahre vor | 8896 votes | 7 comments

Beantwortet
Create tiled layout with openfig
Call gca with the figure handle so you know it's accessing the axes within the figure you just opened (assuming there is only 1 ...

fast 4 Jahre vor | 0

Beantwortet
Why does using 'ButtonDownFcn' function disable datatip?
> Why does using 'ButtonDownFcn' function disable datatip? When you click on an object, the object has no idea of your intentio...

fast 4 Jahre vor | 0

Beantwortet
Can I use ginput (or an analog) in the 2016a App Designer?
ginput is supported in AppDesigner figures starting in MATLAB R2020b For more info: https://www.mathworks.com/matlabcentral/...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Live scripts: Get axes handle of figure NOT stored in live script.
This is why gca should usually be avoided. Here are some solutions in order of robustness. Change the function so that it o...

fast 4 Jahre vor | 1

Beantwortet
Error using plot, "vectors much be same length"
Try, x = linspace(-1.5, 1.5, numel(Sxx)) plot(x,Sxx)

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Multi Colors and Legend for each bar
Colorbar option This is based on the solution from this thread. barData = rand(1,5); figure(); bh = bar(barData); % set...

fast 4 Jahre vor | 0

Beantwortet
Extract data from raster plot
Assuming you don't have the data that generated the figure to begin with, try grabit from the File Exchange. It estimates the co...

fast 4 Jahre vor | 0

Beantwortet
Plotting negative values in boxplot
You could add a second axes that zooms into the small, negative values. [NUM_w,TXT_w,RAW_w] = xlsread("data_boxplot"); flow_...

fast 4 Jahre vor | 0

Beantwortet
heatmap color RGB data for manaully created image
See the 5 lines of code under "new section". I didn't change anything else. % Given data: the sum of Data is equal to 1 % su...

fast 4 Jahre vor | 0

Beantwortet
Event on GIF reset
Without knowing the end goal, I'm not certain this will be useful but it sounds like what you're looking for can be computed or ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
how can I plot y = (cos(t-2)/4)(rect(t+1)/6 )?
is it correct way to write tht code ? The line of code looks functional without knowing any other details including what rect i...

fast 4 Jahre vor | 0

Beantwortet
Grouping rows on the first column and obtain minimum value on second column
A = [13 7 13 6 13 5 13 6 12 7 12 5]; B = groupsummary(A,A(:,1),'min') Note that rows are sorted according to the groupi...

fast 4 Jahre vor | 0

Beantwortet
Changing layers on a bar graph
Plot the green bars first, before the bar plot. Alternatively use uistack to control the stacking order of graphics objects.

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to hold different constellations using scatterhistogram?
scatterhistogram produces a ScatterHistogramChart object within a figure. When you call hold on, an axes is created if it doesn...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Is statistics and machine learning toolbox really required for gscatter plotting?
Here's a workaround I shared a while back using arrayfun. https://www.mathworks.com/matlabcentral/answers/574957-how-can-i-ma...

fast 4 Jahre vor | 0

Beantwortet
Add subtitle to the plot?
If you're using MATLAB R2020b or later, use the subtitle function. If you're using MATLAB prior to that release, you could ad...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
adding title to plots in Tiled Layout increase the Tile spacing
Assign the legend to the TiledChartLayout object rather than the axes. Demo: t=tiledlayout(5,1,'TileSpacing','tight','Paddin...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Writing more efficient Matlab code to test Null hypothesis (T and P values)
Assuming your table has variable names shown in your image, % Read the table from the csv file table = readtable('scores.csv'...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
BoxChart box position doesnt match xaxis label when 'groupbycolor'
The example you shared from the documentation (link) uses grouped data. Groups are centered around the x-ticks. If you are mis...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Geobubble with specifing radius and discretize
The sizedata argument in geobubble determines the relative sizes of the bubbles. If you want to specify the absolute size of th...

fast 4 Jahre vor | 0

Beantwortet
Histogram bin location to place text for categorical data
Since you x-data are categorical, you're working with a categorical ruler. This makes it difficult to position text at numeric ...

fast 4 Jahre vor | 1

Beantwortet
tiledlayout no spacing display in 2x3 grid
imshow fits the axes to your image size. Use axis normal if you don't want the axes to tighten. This will distort your image...

fast 4 Jahre vor | 0

Beantwortet
Change font size on plot but it's cut-off
Suggestion 1: used tiledlayout Axes produced in tiledlayout usually handle these situations better. Suggestion 2: check the P...

fast 4 Jahre vor | 0

Beantwortet
“chasePlot” doesn't show ego vehicle
chasePlot is outside my area of expertise but I did some digging found that if you change the ViewLocation of the scene then you...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
loop for removing highest value until specific value is reached
A = randi(13,10); while sum(A,'all','omitnan')>20 [~,idx] = max(A(:),[],'omitnan'); A(idx) = NaN; end isRemove...

fast 4 Jahre vor | 0

| akzeptiert

Mehr laden