Réponse apportée
conditional adding of elements to an array
Not the most beautiful code I've ever written, but this should do what you want. I tested it as well with [0 50]. a=[2 2 4 ...

plus de 8 ans il y a | 0

Réponse apportée
how to find index of duplicate values in a matrix ?
This code should do the trick: A = [1 2 3 ; 4 2 3]; vals=unique(A(:)); a=cellfun(@fun,num2cell(vals),repmat({A},numel...

plus de 8 ans il y a | 2

Réponse apportée
How to find out mm on dicom images
The |ReconstructionDiameter| field contains the width of your image in mm (at least for CT), |PixelSpacing| should contain the h...

plus de 8 ans il y a | 1

Réponse apportée
String X-axis for bar plus line plot
You need to explicitly set the |XTick| property as well. To rotate the labels, you can use the |XTickLabelRotation| property.

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to take sum of grey value of an image
IM=imread('image.png'); %IM=mean(IM,3);%convert RGB to grey IM=rgb2gray(IM); sumval=sum(IM(:)); You forgot to atta...

plus de 8 ans il y a | 1

Réponse apportée
How to save the name of a variable and a folder using -printf?
You can do this with |eval|, but you shouldn't. Use a cell array instead. (I have taken the liberty of adapting some of <http...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to process and plot the data from the .txt files when the filenames rae not sequential?
You can use |dir| to generate a file list and apply any sort order you wish. list=dir('Cyprus*.txt'); Edit: the code b...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to create a piecewise function using if and else statements?
Or without a loop: x=-5:5; y=NaN(size(x));%pre-allocate to NaN so you notice it if some values are outside all your cond...

plus de 8 ans il y a | 1

Réponse apportée
Do calculations for certain hours in a 3D array
You can use the |hour| function to get the submatrix with logical indexing. temp=A(:,:,hour(date_vec)==8); mean_val=sum(...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to align properly using sprintf?
Using a fixed-width font will help if you're trying to align text with numbers of characters.

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How to combine repeated same value to a single value or variable
You can use <https://www.mathworks.com/help/releases/R2017b/matlab/ref/unique.html#btb0_85 |unique|>.

plus de 8 ans il y a | 1

Réponse apportée
How to save a figure with slider into a .fig file?
No. You'll have to include the .m file. It might even be an idea to use the .m file to generate your figure from scratch. If you...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
hello, I am trying to evaluate an equation for L=0.5:0.1:3, α=0:0.1:1 and n=1:1:400. I am not sure how to use nested for loop for this.
You can use |mesgrid| to create arrays to calculate every unique combination of L, alpha and n. as far as I know, Matlab can onl...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Find mean and standard deviation of a plot.
If you have the underlying data, you can use the |mean|, |std|, |skewness| and |kurtosis| functions.

plus de 8 ans il y a | 1

Réponse apportée
Determine the point where the slope is '0' on a histogram
You should fit a distribution first, so then you can be more confident about your result. In this case, it looks like simply usi...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
how to import a text file in to matlab
You should use the |fileID| variable, as that is the handle to your file. You didn't define |test1.txt| as a variable of class, ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Finding index to minimum values in 3D array
The |isequal| function thinks the code below works. A=rand(10,8,3); [a,b]=min(A,[],3); indexToMinIn3rdDim = NaN*o...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
1 if true, 0 if false: analyzing data from excel with text condition
Another possibility of what you might mean is the code below. This also shows how intuitive logical indexing can work. Note that...

plus de 8 ans il y a | 0

Réponse apportée
Round date and hour to the previous 15 minute interval
Dateshift would be a good solution, but it can only shift to quarter years, not quarter hours. The code below is a way around th...

plus de 8 ans il y a | 2

| A accepté

Réponse apportée
Rotate 1 by N vector
You mean something like this? v=1:10; v2=imrotate(v,45);

plus de 8 ans il y a | 1

Réponse apportée
How to adjust the code to work with 3D stack of images?
When you have problems with dimension, you should use the debugger to go through your code line by line and check in the Workspa...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Find Max value with index
Your current code doesn't return a maximum value for each group. The code below should do what you need. groups=[1 2 2 1 3 ...

plus de 8 ans il y a | 1

Réponse apportée
Error using randi (first input must be a positive integer scalar value)
As the error message said, the values must be integers in increasing order. Your original code did not have the correct order, a...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
growning data storage after each loop
Do you mean something like the code below? I'm assuming this is a small example and not your actual code, so I didn't bother opt...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
Calculate average change % in a group
The <https://www.mathworks.com/help/releases/R2017b/matlab/ref/unique.html |unique|> function should help you out here.

plus de 8 ans il y a | 0

Réponse apportée
change x,y,z axes position in a 3d plot graph
You can use the <https://www.mathworks.com/help/releases/R2017b/matlab/ref/axis.html#inputarg_limits |axis|> function with a 6...

plus de 8 ans il y a | 0

Réponse apportée
Could anyone help me to solve the issue
You need to save the handles to the line objects (i.e. the output of |plot|) in an array. Then you can re-order that array as yo...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
How can i put my matlab application online?
You shouldn't <https://www.mathworks.com/matlabcentral/answers/386563-how-can-i-put-my-matlab-application-online double-post>. ...

plus de 8 ans il y a | 0

| A accepté

Réponse apportée
ECG signal in my GUI
If you don't want to use those functions, you'll have to generate an image, which will be very slow. A good idea might be to ...

plus de 8 ans il y a | 1

Réponse apportée
RMSE between two variables
To learn Matlab, you can use a guide like <https://matlabacademy.mathworks.com/R2017b/portal.html?course=gettingstarted this one...

plus de 8 ans il y a | 3

Charger plus