matlab-figure

Matlab Plot that changes with time

落花浮王杯 提交于 2020-01-07 06:18:09
问题 I am trying to plot a figure that changes with time (think of it as plotting the shape of a pole as the wind passes through it, so I want to plot the shape at every second). To avoid the x axis limit changing frequently I want to fix it to the limits (max and min that I calculate before plotting). Here is a sample of my code: for i=1:1:numberofrows momentvaluesatinstant = momentvalues(i,:); figure(1) plot(momentvaluesatinstant,momentheader) drawnow title(sprintf('Moment profile along pile at

How do I pass an array of line specifications or styles to plot?

时光怂恿深爱的人放手 提交于 2020-01-07 02:49:06
问题 I want to plot multiple lines with one call to plot() , with different line styles for each line. Here's an example: Both plot([1,2,3]', [4,5;6,7;8,9], {'-o', '-x'}) and hs = plot([1,2,3]', [4,5;6,7;8,9]) set(hs, 'LineStyle', {'--'; '-'}) don't work. I've tried a whole bunch of arcane combinations with square and curly braces, but nothing seems to do the trick. I know it's possible to loop through the columns in Y and call plot() for each one (like in this question), but that isn't what I'm

updating data within same GUI in MATLAB

こ雲淡風輕ζ 提交于 2020-01-06 20:23:52
问题 I've created one image editor window in MATLAB, which includes various operations including brightness, contrast, crop, rotate etc.., In this GUI, each operations has its own function call backs. My problem is with linking one function with another. if i crop image, then if i change brightness my current code changes brightness of original image rather than cropped image. similarly at first i if change brightness and then if i crop, my code will crop original image rather than brightened

How do I get the Matlab data point labels correct? Part 2

本小妞迷上赌 提交于 2020-01-06 07:07:07
问题 I've created some Matlab code which anyone helping can run and see the problem. When I run the following code, for each data point on my plot I seem to get all 15 labels instead of only 1 specific label. So how do I get the Matlab data point labels correct for the following code? Based on the the suggestions from my previous question, I did the following: I replaced these two lines of code: labels = num2str(test_vector_label,'F%d'); labels_cell = cellstr(labels); With this line of code as

Color of errobar different from the graph matlab

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 04:49:27
问题 i have this problem i want to make a color of errobars different from the color of my graph there is the code i have tried pp=errorbar(x,testMatriceFluxSortie/ValeurFluxSortie(1,1),err) pp.Color=[255 0 1]./255; But it gives me this all in red my graph 回答1: you can always use hold on and plot only the x,y data after the errorbar was plotted, for example: x = 1:10:100; y = [20 30 45 40 60 65 80 75 95 90]; err = 8*ones(size(y)); errorbar(x,y,err,'or'); hold on plot(x,y,'b'); 来源: https:/

Colorbar in MATLAB placing too many numbers in figure

耗尽温柔 提交于 2020-01-05 04:17:06
问题 I'm trying to make contour map and have been stuck putting a colorbar onto the figure. I am currently using the following code: abi = -7:0.1:4; sbi = 0:1:75; [xx, yy] = meshgrid(sbi(2:end), abi(2:end)); contour(xx', yy', rm3d); colorbar; Where rm3d is a set a values corresponding to each intersection point between abi and sbi. Everything works as expected through the contour line, but the colorbar does something funky. Looks like it is populating numbers across the screen, as in this picture:

Structure of handles of GUIs MATLAB

橙三吉。 提交于 2020-01-05 03:46:28
问题 I have three GUIs in MATLAB. The tag of each of them is 'P0' , 'P1' and 'P2' . I would like to put the handles of all three GUIs in a structure and be able to get to this structure from any of three GUIs and update the values in it. What is the best way to accomplish this? 回答1: You have a couple of options on how to do this. One way would be to use the root graphics object along with setappdata and getappdata to store and retrieve values. fig0 = findall(0, 'tag', 'P0'); fig1 = findall(0, 'tag

Matlab: How to set color of legend in a scatter plot where each data point gets a different color?

别等时光非礼了梦想. 提交于 2020-01-04 05:42:10
问题 Here is the sample code: x = rand(100,1); y = rand(100,1); score = rand(100,1); figure; colormap(flipud(bone)); caxis([0 1]) axis([0 1 0 1]) scatter(x,y,50,score,'+','LineWidth',2); legend('scores'); I'm using the reversed 'bone' colormap which assigns pure white to score value 0 and pure black to score value 1. However, the legend seems to be automatically assigned the score 0, and so if you run the code the legend color is pure white and not visible. Is there any ways to fix that? Thanks.

Matlab - Scale Colorbar of Image

只愿长相守 提交于 2020-01-04 04:36:07
问题 How can I scale the colorbar axis of a false color image? I read this post,and copied the code but it seems not to work correctly: MATLAB Colorbar - Same colors, scaled values Please see the two images below. In the first (without the scaling) the coloraxis goes [1 2 3 4 5 6]*10^4 In the second image, it goes [0.005 0.01 0.015 0.02 0.025] The correct scaling (with C = 100000 ) would be [0.1 0.2 0.3 0.4 0.5 0.6] Without scaling Wrong scaling I want that the coloraxis is scaled by 1/C and I can

Plot to figures without bringing them into foreground

╄→尐↘猪︶ㄣ 提交于 2020-01-04 02:11:06
问题 figure; ax1 = axes; figure; ax2 = axes; x = 0; y = 0; while ishandle(ax1) && ishandle(ax2) x = x + 1; y = y + 1; figure(1) scatter(x,y, 'MarkerEdgeColor', 'red') hold on figure(2) scatter(x,y, 'MarkerEdgeColor', 'blue') hold on end In my script I have multiple figures, which are going to be updated in a loop. The figures have to be displayed, while the script is running. Unfortunately the currently updated figure is always popping in the foreground, which makes it impossible to monitor a