Answered
Most efficient way to sum anti-diagonal elements
You could try S = sum(sum(A - diag(diag(A))));

9 years ago | 0

Answered
Need to remove the black background from image patches
You can detect an all-black patch P if the maximum value is 0 (in the ideal case) or below a certain threshold, say 0.1 (if the ...

9 years ago | 0

Answered
How can I assign numeric values to strings in an array?
You can use a structure S = struct('Name', {{'RH' 'OH' 'RO2' 'H20'}}, 'Value', [100 100 0 0])

9 years ago | 1

| accepted

Answered
how can I get the mean of each two columns of a matrix ?
mean(reshape(mean(X), 2, []))

9 years ago | 0

Answered
How to remap all negative and positive value in 0 to 1 scale in polar plot?
r = [0.5 -0.2 -0.3 0.1]; r = r - min(r); r = r/max(r);

9 years ago | 0

| accepted

Answered
creating structures in nested for loop
You use b as index into a matrix ish(a,b) with b=0:0.1:1. This does not work, indices have to be 1, 2, 3,... or logical, ...

9 years ago | 0

Answered
How can I include a repeated word into a matrix?
Use strcat L1 = ['2016_Subject_'; '2016_Subject_'; '2016_Subject_'] L2 = ['_01'; '_02'; '_03']; strcat(L1, 'Speed'...

9 years ago | 2

Answered
Need help in uderstanding this piece of code
You generate a row vector [y1(ii),z,smax] And this vector is assigned to row "idx" of the output matrix output(idx,...

9 years ago | 0

Answered
how to make inverse fourrier transform in the correct way?
Simple as this: u = fft(x); x2 = ifft(u); The difference is within the tolerance of machine precision: max(abs(x ...

9 years ago | 0

| accepted

Answered
How does one have arrays in a Matlab share the same memory
You cannot do that in Matlab.

9 years ago | 1

Answered
How to use the data, but no polar function, to make polar plot?
theta = deg2rad(0:359); r = [1 2 3 1.5]; r = repmat(r, 90, 1); r = r(:)'; plot(r.*cos(theta), r.*sin(theta)) axi...

9 years ago | 0

Answered
how to loop through subfolders and apply a particular function
You get use my function getfn to get all pgm images in all subfolders fn = getfn(mkdir, 'pgm$') And then you work on the...

9 years ago | 0

Answered
How to calculate the mean value of the 3rd dimension of YUV so as to filter the differences between consecutive frames ?
meanY = mean(compV(:)); or if you have the Image Processing Toolbox: meanY = mean2(YUV(:,:,3));

9 years ago | 0

Answered
How to create a loop that runs a function through subfolders in a directory?
You can run my function getfn to get all txt files in the current directory and all subdirectories. You can then work on the ret...

9 years ago | 3

Answered
How to insert values on top of Each bar in Matlab also with names on x-axis.
Use text(x, value, num2str(value)) and find out the appropriate values for x, and use 'VerticalAlignment', 'top' for ne...

9 years ago | 0

Answered
Remove an element from a vector, using most computationally efficient solution
If your "someCondition" is indepent of variable "i" in your original post, you can do it like this: idx = vector1 == someCo...

9 years ago | 2

| accepted

Answered
How to do this
A = [0.36 0 0.9 0.4 0.26 0.1 0 0 0.5 0 0 0.8 0.6 0.75 0.4 0.88]; sum(...

9 years ago | 0

Answered
How to make a vector linearly spaced?
I cannot reproduce the error. This works fine for me: t=[7.2285 8.2285 16.4685]; t2 = 0:0.0001:t(end); [f idx] = isme...

9 years ago | 0

Answered
How to audiowrite a soundfile from m4a to wav?
Use audioread to read the m4a. audioread returns y and Fs, and you can pass these to audio write: [y, Fs] = audioread('hoi....

9 years ago | 0

Answered
stem plot with bars that don't go through zero
You can use my function stem2 to do it: X = linspace(0,2*pi,50)'; Y = [cos(X), 0.5*sin(X)]; h = stem2(X,Y); set(h,...

9 years ago | 1

Answered
Using the force output calculated in one script as an input to mass/spring damper
Turn your script into a function by adding these lines on top of your script function F = morison(t) if nargin == 0 % de...

9 years ago | 0

Answered
How to sort 3D data into bins?
Try hist3.

9 years ago | 0

Answered
Resize correctly plot axis
If you have your data for x = 1, 2, 3, 4, ..., you can introduce a new variable idx = 1:1000; % or idx = 1:200 and use ...

9 years ago | 0

Answered
get rid off redundant values
B = unique(A, 'rows'); or, if you need the same order in the matrix B = unique(A, 'rows', 'stable');

9 years ago | 0

Answered
convert string to cell array
clear x x{1} = 'A'; x{end+2} = 'B'; x{end+3} = 'C'; and so on

9 years ago | 0

| accepted

Answered
How to save files to Mac through MATLAB accessed remotely?
If I run matlab remotely, I use save to save to the file system of the remote machine. Next, I copy these files to my machine us...

9 years ago | 0

| accepted

Answered
How to check the intersection of the line with a circle?
For a horizontal line, you just have to check if the y position of the circle is closer to the line than the radius: idx = ...

9 years ago | 1

| accepted

Answered
Open Files by File Name Patterns
find(cell2mat(regexp(names, 'HI_\dC_TTTT\d_\d{3}\.xlsx', 'start'))) \d matches a digit, \d{3} matches 3 digits, \. matches ...

9 years ago | 1

Load more