Réponse apportée
How to pass an argument for a function when it is an argument in another function?
If r is definied beforehand you can create a function handle that turns your 2-argument function into a 1-argument function e.g....

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Can somebody help me with this script?
iscell checks if you have a cell array. uigetfile will return a cell array if multiple files are selected, otherwise it wi...

plus de 8 ans il y a | 0

Réponse apportée
Passing workspace variable to matlab App Designer
<https://uk.mathworks.com/matlabcentral/answers/284140-call-an-mlapp-with-input-argument-s This thread> gives a workaround for t...

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
Write a function to calculate the area of a circle
It isn't obvious from point 4 if it is expected that you just output -1 if any input is negative or -1 in only that location, bu...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Does "mex" function require a specific toolbox?
mex only requires base Matlab, no additional toolboxes.

plus de 8 ans il y a | 0

Réponse apportée
[DEPRECATED] What frustrates you about MATLAB?
Most frustrating thing for me at the moment is at times Matlab starts endlessly beeping at me with the error sound. At first I ...

plus de 8 ans il y a | 0

Réponse apportée
How to choose divisible numbers for a data?
doc factor will give you prime factors. You can take it from there to decide your own factors.

plus de 8 ans il y a | 0

Réponse apportée
how to convert a single row matrix into a number (double)
a = [1 2 3 4 5]; str2double( strrep( num2str( a ), ' ', '' ) ) works, but I'm sure there are more elegant or robust ways...

plus de 8 ans il y a | 0

Réponse apportée
Fitting to a homemade function
x = lsqcurvefit(@(D, xData) MyFun( a, H, D, xdata ),ydata ) should work, I think...

plus de 8 ans il y a | 0

Réponse apportée
Selection of greater than or less than symbol in app
I would just use a single if statement to get your operand as a string and convert it to a function handle, e.g func = ...

plus de 8 ans il y a | 1

| A accepté

Réponse apportée
GUI elements locations has changed position
If you are using GUIDE there is an Object Browser in the View menu that allows you to gain access to every component, even if it...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
For loop ranging from negative to positive integers?
Just create an array of e.g. inputVals = -12:20; Then use indices in your loop: for i = 1:numel( inputVals ) A...

plus de 8 ans il y a | 1

Réponse apportée
How can I make mlint return all the variable names in my .m-file?
You should just be able to use e.g. ismember( 'Energy', T.Properties.VariableNames ) ismember( 'Power', T.Properties.Var...

plus de 8 ans il y a | 1

Réponse apportée
The variable in a parfor cannot be classified, parfor
Something similar to this should work (it gives no M-Lint warnings at least) num_col = 1000; days_simulation = 400; S...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
I want a MATLAB code that will resize a given image into 25x25 image using multiple images from a folder
If you have the Image Processing Toolbox then doc imresize should work fine. Use a loop if you want to do it for 649 im...

plus de 8 ans il y a | 0

Réponse apportée
imagesc: how to set NaN as white color
doc colormap allows you to define whatever colourmap you want. You can tag a white point on the front of e.g. a Parula colourma...

plus de 8 ans il y a | 2

Réponse apportée
how can i make figure longer on the x-axis and y-axis
doc pbaspect doc daspect both affect data plotting aspect ratio, if that is what you are asking, but you didn't really a...

plus de 8 ans il y a | 0

Réponse apportée
How to set axis of a plot to correspond to their values.
doc pbaspect doc daspect can be used to control the aspect ratio of the plotting area and the data. Also axis eq...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Assigning multiple variables vectors from a cell array
[a1, a2, a3, a4] = cellArray{:}; It is not advisable generally to do this, but for the record, that syntax should work. Ha...

plus de 8 ans il y a | 1

Réponse apportée
How can i find the position of nearest number "x" in a matrix "a"
[~,pos] = min( abs( a - x ) ); nearestNum = a( pos );

presque 9 ans il y a | 0

Réponse apportée
How to plot a given signal but by setting a limit on the X value
doc xlim will change the axis limits someArray(1:200) will allow you to only access the first 200 samples of the ar...

presque 9 ans il y a | 0

| A accepté

Réponse apportée
Retrieve constant property from class handle reference
myClass.myProp will give you the constant property, you don't need an instance of it. ref = @myClass is a function ...

presque 9 ans il y a | 0

Réponse apportée
How to round a result to 1 decimal place.
Which version of Matlab do you have? round( data * 10 ) / 10; is a fairly standard alternative.

presque 9 ans il y a | 1

Réponse apportée
ignore spesific values in my plot
x=[-0.13*pi:0.01:0.13*pi]; x = setdiff( x, 0 ); would be one way. Just creating x in the first place without it contain...

presque 9 ans il y a | 1

| A accepté

Réponse apportée
Matrix calculation to find the average value
D = A + B + C works fine and is surely obvious?! mean( D ) will then give you the result you want, although your nu...

presque 9 ans il y a | 0

Réponse apportée
How do I make the theta-axis or x-axis change color?
hAxes.XAxis.Color = 'b'; will, for example turn the x axis of an axes handle, hAxes, blue. Obviously you can use an RGB tr...

presque 9 ans il y a | 0

Réponse apportée
Implementing listener and callback, infinite loop
Personally I always use addlistener syntax when adding a listener. I am not familiar with your syntax, but it seems it will sti...

presque 9 ans il y a | 0

| A accepté

Réponse apportée
Index exceeds matrix dimensions error after code finishes
Use strcmp, not == when testing equality of strings. e.g. if strcmp( Code( counter ), 'Y' ) ... end

presque 9 ans il y a | 0

Réponse apportée
Search specific numbers in column
badRowIdx = find( results( :,6 ) == 1 ); results( badRowIdx, : ) = []; should remove these lines.

presque 9 ans il y a | 0

| A accepté

Réponse apportée
How to count count number of times change occured
v1 = [0 0 1 1 1 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0]'; v1Delta = [0; diff( v1 )]; v1ChangeCount = v1Delta; v1ChangeCount( v...

presque 9 ans il y a | 1

Charger plus