Answered
Inner matrix dimension problem
You can multiply the vectors by a * b.' a.' * b dot(a, b)

9 years ago | 0

| accepted

Answered
Multiplication of cell arrays
|cellfun| is smart, but harder to debug than a simple loop. mul = cell(2, 7); for x=1:2 for y=1:7 mul{x,y}...

9 years ago | 1

| accepted

Answered
Check if handle to axes exists at all [R2017b]
The code is not meaningful. You can always know, if the axes has been created before or not. Therefore it is not clear, what you...

9 years ago | 1

| accepted

Answered
Removing/filtering short periods of a value from a vector
With <https://www.mathworks.com/matlabcentral/fileexchange/41813-runlength FEX: RunLength>: [B, N] = RunLength(example_sig...

9 years ago | 0

Answered
Mean of values above a threshold
Data = rand(900, 804, 366); mask = (Data > 0.65); Data(~mask) = 0; meanData = sum(Data, 3) ./ sum(ma...

9 years ago | 2

| accepted

Answered
Figure printing size and printing in latex
If you create a PDF, not the 'Position' of the figure matters, but the 'PaperPosition' and 'PaperUnits'. If you have the hand...

9 years ago | 0

Answered
How can a process bar/wait bar run during a function is running
Think twice: How can the waitbar get information about the current level of progress? Therefore it must get data from inside you...

9 years ago | 0

| accepted

Answered
Optimise/replace this for loop used in calculation of mutual information
Sorting the complete array is a waste of time if all you need is the k.th smallest element. Under Matlab 2017b see <https://www....

9 years ago | 2

Answered
Thanks for the productive cooperation
There are some rare cases of discussions, which became a battlefield. But many other threads encourage me to participate in this...

9 years ago | 3

Answered
Too many input arguments error
The error message concerns |squeeze|: A = Img(:,:,S,:) B = ImgSg(:,:,Si,:); C = ImgCr(:,:,S1,:); X = squeeze(A, B,...

9 years ago | 1

Answered
How to synchronize three planes on the same figure to run simultaneously
Maybe you can find something useful here also: * <https://www.mathworks.com/matlabcentral/fileexchange/20604-3d-slice-viewer>...

9 years ago | 1

Answered
Could anyone help me to solve the error
The error message gets clear, if you read the documentation: doc sum Please do this before you ask in the forum if you h...

9 years ago | 1

Answered
How to sum all instances of a value across a variable?
a = [1 2 2 1] k = 1; sumOf1 = sum(a(a == k)) or sumOf1 = k * sum(a == k) But maybe you want to get ...

9 years ago | 0

| accepted

Answered
i need this equation matlab code any body help me.
gbar = sum(g(:)) / (M * N); sigma2 = sum((g(:) - gbar) .^ 2) / (M * N - 1); Looks straight forward. But what about: ...

9 years ago | 0

Answered
How to save passed value between two functions(callbacks) after closing the GUI?
If you want to store the data of a GUI after the GUI was closed, you have to save them to the disk, e.g. in the CloseRequestFcn ...

9 years ago | 2

Answered
Speed up for loop in this code for calculating mutual information (maybe using GPU computing)
For a 1000x1000 matrix, this is 6 times faster already: % Version 1: n = size(X, 1); X = X.'; Y = Y.'; dx = ze...

9 years ago | 2

| accepted

Answered
Probability of random number generator
It is not meaningful to ask, if the numbers replied by |rand()| have the same probability. Example: x = rand(1, 2) Then ...

9 years ago | 0

Answered
how can i use audioplayer command in my GUI to play an audio?
Replace sound(Y, FS, BITS) by S = audioplayer(Y, FS, BITS); S.play();

9 years ago | 0

Answered
I can't install Matlab2017b
The actual problem is: java.lang.IllegalArgumentException: Negative time at java.io.File.setLastModified(File.java:1427)...

9 years ago | 0

Answered
How can I build a function with excel data
function ProcessExcelFile(FileList) % FileList is a cell string of file names for k = 1:numel(FileList) File = File...

9 years ago | 0

Answered
how to combine two arrays?
Your |all_data| is a cell array. And in a1 = {'cap','earn','PE'} % Trailing ) replaced by } a2 = zeros(2,3) a = [a...

9 years ago | 0

Answered
Getting the data point from two plotted curves in one figure
h = findobj(gca, 'Type', 'line'); x1 = get(h(1), 'XData') y1 = get(h(1), 'YData') x2 = get(h(2), 'XData') y2 = ge...

9 years ago | 1

| accepted

Answered
Write A Matlab Function of a matrix
If you are looking for a unique list of elements, start with a search in the documentation: docsearch unique You will fi...

9 years ago | 1

Answered
How to find out location where temperature is high based on color graph using Matlab?
If you have an RGB image and a colormap (which seems to be the case), you can convert it to an indexed image: IndexImage = ...

9 years ago | 3

Answered
Replace numbers by strings
Or: Pool = {'case1', 'case2'}; B = Pool((A < 90) + 1) Or: B = sprintfc('case%d', (A < 90) + 1)

9 years ago | 1

Answered
How to save separate '.mat' files with the image name including it ?
I am using 'try' and 'catch' to generate the database. Although this works, it is cleaner to check for the existence of the ...

9 years ago | 1

| accepted

Answered
How to reverse a number
A vectorized version of Roger's method: n = 8549; d = 10 .^ (0:floor(log10(n))); % [1 10, 100, 1000] v = rem(floor(...

9 years ago | 1

Answered
How to plot 3 y axis or more in a single graph?
Do you mean something like <https://www.mathworks.com/matlabcentral/fileexchange/46688-jzplotys-zip> or <https://www.mathworks.c...

9 years ago | 2

Answered
Text Not Showing On Plot
If the x axis goes from x(1)-0.1 to x(1)+0.1, the text drawn at x(1)+0.5 is outside the visible area. Does this happen in your c...

9 years ago | 0

| accepted

Answered
How can I plot a series of points in a vector with two coordinates x&y considering that I want to name these points respectively S1, S2....S10, and I want to use them in other functions just by using their "name"?
This sounds like a rather complicated and indirect way of programming. Of course your could simply create a set of variables: ...

9 years ago | 0

Load more