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

más de 8 años hace | 0

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

más de 8 años hace | 2

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

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

más de 8 años hace | 2

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

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

más de 8 años hace | 0

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

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

más de 8 años hace | 3

Cargar más