Risposto
Problem with textscan when file doesn't exist.
Either insert a check if the file exists (use |exist('userdata.txt','file')|), or wrap this in a try-catch block. I would advise...

oltre 8 anni fa | 0

| accettato

Risposto
What is the most efficient way to find the position in the column of a matrix where the value drops below a given threshold (values are constantly decreasing down the columns)?
It will be much faster to use |find|, but you don't even need to. You can use |meshgrid| to generate indices (like |repmat((1...

oltre 8 anni fa | 0

Risposto
Histogram plotting where the x-axis is in multiples of 0.1
<https://www.mathworks.com/help/matlab/ref/histogram.html Yes.>

oltre 8 anni fa | 0

Risposto
Double for loop with problems
Just do it without a loop: temp=[22 23 25]; new_matrix=temp(:); new_matrix(1,13)=0;%extend with zeros new_matrix=n...

oltre 8 anni fa | 0

| accettato

Risposto
Location pixel and slice
If you had only a 2D question, you could use |find|, but for some odd reason, it doesn't support more than 3D, so I've made a FE...

oltre 8 anni fa | 0

| accettato

Risposto
Stitching three channels of an image
In Matlab (and some other languages) this is referred to as concatenation, for which you can use the function |cat|. Rp=ima...

oltre 8 anni fa | 0

| accettato

Risposto
Reading Multiple excel files with different file names
D = dir(['C:\Users\paroo\Desktop\Filtered', '\*.xlsx']); filenames = {D(:).name}.'; data = cell(length(D),1); for ii ...

oltre 8 anni fa | 1

| accettato

Risposto
how to make a new figure in GUI by pressing pushbutton without changing in window size & position ?
pos=get(gcbf,'Position'); set(handle_to_new_figure,'Position',pos); close(gcbf);

oltre 8 anni fa | 0

| accettato

Risposto
Returning to main gui from other gui
A guess for a solution: give a handle to your main GUI window as an input, and include in the |CloseFcn| of your second window s...

oltre 8 anni fa | 0

Risposto
How to replace pixels with for loops
# create a binary mask that is either true for subject pixels, or true for green screen pixels, the choice doesn't matter much. ...

oltre 8 anni fa | 0

Risposto
how can I scan the image by using a small window and then count the number of pixels which are greater than threshold value at each window location.. help me I have tried some codes,but not accurate..
First apply the threshold and then convolve your window with that (just create a flat SE with |ones()|). If you need some cod...

oltre 8 anni fa | 0

Risposto
MATLAB GUI: Is it possible to change the appearance/properties of your figure if a certain action is done?
The easiest solution is to simply hide the other boxes (by setting the 'Visible' property to false). Make sure that the callb...

oltre 8 anni fa | 0

Risposto
Customizing xticks yields error: " Undefined function 'xticks' for input arguments of type 'double'."
The |xticks| function was introduced in R2016b. In earlier releases you must use the code below (this code also works on newer r...

oltre 8 anni fa | 4

| accettato

Risposto
How can I use legend function to in multi columns?
This should still work: <https://blogs.mathworks.com/pick/2011/02/11/create-multi-column-plot-legends/>

oltre 8 anni fa | 0

Risposto
Split vector into increasing and decreasing
A=[1 1 2 2 3 3 8 9 4 3 2 2 2 1 0]; idx=find(diff(A)<0,1);%only get the first value part1=A(1:idx); part2=A((idx+1):end);

oltre 8 anni fa | 0

Risposto
How to best fit a curve to my data
You need to change the starting guesses and you might have to adjust the function itself. x=0:0.01:10; y=1-exp(-x); plot(...

oltre 8 anni fa | 0

Risposto
Why is matlab returning value 1 (logical) after reading from file and writing to xls
If you read the documentation (type |doc xlswrite|), you will see this syntax: status = xlswrite(___) So what you are do...

oltre 8 anni fa | 0

Risposto
out of memory, how to solve?
As Walter hinted, the problem is implicit expansion: A=1:4; B=A'; A.*B ans = 1 2 3 4 ...

oltre 8 anni fa | 0

Risposto
How can I change the number range from origin to edge in polar plot?
You can use either of these two: set(gca,'RLim',[0 9]) rlim([0 9]) (You can get hints about where to look by using |g...

oltre 8 anni fa | 1

| accettato

Risposto
Connect multiple y-coordinate points with smooth curve
If <https://www.mathworks.com/help/matlab/ref/spline.html |spline|> doesn't work directly, you can convert your data set to a pa...

oltre 8 anni fa | 0

Risposto
How to convert a MATLAB App to standalone .exe file?
<https://nl.mathworks.com/matlabcentral/answers/335101-can-i-transform-the-app-design-matlab2016b-to-executable-form#answer_2629...

oltre 8 anni fa | 1

| accettato

Risposto
question regarding global variables
You shouldn't use globals anyway. But yes: as long as you don't declare a variable as global, you can use it as a normal variabl...

oltre 8 anni fa | 0

Risposto
How to loop shift a matrix for N times but keeping the result from each iteration?
You might be able to do this with |cellfun|, although I am not sure you will get a very fast script. C=cellfun(@(m) circshi...

oltre 8 anni fa | 0

Risposto
Maintaining figure when adding new data values?
Make sure |daspect| is set to [1 1 1]. You can also use the <http://www.mathworks.com/matlabcentral/fileexchange/64996-triang...

oltre 8 anni fa | 0

Risposto
How can i graphic this function?
Look into the |meshgrid| function to create a grid of your coordinates, make sure the syntax of your formula supports element-wi...

oltre 8 anni fa | 0

Risposto
how to call a function inside a button created in a function?
Start with saving all the handles in one or multiple arrays when you initialize them (save them to |guidata| so you can get to t...

oltre 8 anni fa | 0

| accettato

Risposto
Error using horzcat. Dimensions of matrices being concatenated are not consistent.
time=[0:0.1:101]'; y1=wgn(size(time,2),size(time,1),0); y2=y1'; sigdata=[time y2];

oltre 8 anni fa | 1

| accettato

Risposto
How to auto rotate x/y/z-label to the same angle as the axis?
You can get a handle to the 3d rotation, so if you determine the appropriate rotation (e.g. with the output of |view|), you can ...

oltre 8 anni fa | 1

Risposto
how to plot something one by one
Use |drawnow| and/or a short |pause|. This will give Matlab time to process callback to buttons and update visuals.

oltre 8 anni fa | 0

| accettato

Carica altro