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

oltre 8 anni fa | 0

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

oltre 8 anni fa | 2

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

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 1

Risposto
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(...

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

Risposto
Find mean and standard deviation of a plot.
If you have the underlying data, you can use the |mean|, |std|, |skewness| and |kurtosis| functions.

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

Risposto
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, ...

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

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

oltre 8 anni fa | 2

| accettato

Risposto
Rotate 1 by N vector
You mean something like this? v=1:10; v2=imrotate(v,45);

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 1

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

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

oltre 8 anni fa | 0

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 0

| accettato

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

oltre 8 anni fa | 1

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

oltre 8 anni fa | 3

Carica altro