Beantwortet
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...

etwa 8 Jahre vor | 0

Beantwortet
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...

etwa 8 Jahre vor | 1

| akzeptiert

Beantwortet
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...

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
Does "mex" function require a specific toolbox?
mex only requires base Matlab, no additional toolboxes.

etwa 8 Jahre vor | 0

Beantwortet
[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 ...

etwa 8 Jahre vor | 0

Beantwortet
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.

etwa 8 Jahre vor | 0

Beantwortet
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...

etwa 8 Jahre vor | 0

Beantwortet
Fitting to a homemade function
x = lsqcurvefit(@(D, xData) MyFun( a, H, D, xdata ),ydata ) should work, I think...

etwa 8 Jahre vor | 0

Beantwortet
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 = ...

etwa 8 Jahre vor | 1

| akzeptiert

Beantwortet
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...

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 8 Jahre vor | 1

Beantwortet
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...

mehr als 8 Jahre vor | 1

Beantwortet
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...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 8 Jahre vor | 0

Beantwortet
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...

mehr als 8 Jahre vor | 2

Beantwortet
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...

mehr als 8 Jahre vor | 0

Beantwortet
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...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 8 Jahre vor | 1

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

mehr als 8 Jahre vor | 0

Beantwortet
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...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

mehr als 8 Jahre vor | 0

Beantwortet
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.

mehr als 8 Jahre vor | 1

Beantwortet
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...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 8 Jahre vor | 0

Beantwortet
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...

mehr als 8 Jahre vor | 0

Beantwortet
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...

mehr als 8 Jahre vor | 0

| akzeptiert

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

mehr als 8 Jahre vor | 0

Beantwortet
Search specific numbers in column
badRowIdx = find( results( :,6 ) == 1 ); results( badRowIdx, : ) = []; should remove these lines.

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 8 Jahre vor | 1

Beantwortet
How to extract RGB values of each pixel from an image?
r = im(:,:,1); g = im(:,:,2); b = im(:,:,3); assuming img is an RGB image of n*m*3 size, for any n, m

mehr als 8 Jahre vor | 0

Mehr laden