Answered
Finding the indices of duplicate values in one array
function Ind = IndexOfMultiples(A) T = true(size(A)); off = false; A = A(:); for iA = 1:numel(A) if T(iA) % ...

8 years ago | 2

Answered
How to replace NaN by comparable values of other variables?
I guess, the problem occurs, when several matching values are found by: t=find(dist_from_current_point==nearest_dist); M...

8 years ago | 0

| accepted

Answered
why am I getting error "Undefined function or variable"
"all of a sudden" - you can be sure, that this happens, because you instruct Matlab explicitly to delete the variable. Withou...

8 years ago | 0

| accepted

Answered
restart a for loop when a condition is met
What about this: for j = 1:4 [id1, C1, sumd1, d1] = kmeans(gg{m}{i},j,'Distance','sqeuclidean'); ...

8 years ago | 0

Answered
I am trying a construct a matlab code such that it will solve an almost tridiagonal matrix. The input I want to put in is the main diagonal a=-4 the upper diagonal b=- 1 and the lower diagonal and c=-1.
Use the backslash operator: x = A \ b If your matrix is tridiagonal and you do not want to let Matlab apply an efficient...

8 years ago | 0

Answered
I need help finding the average across a 1x5 cell array
% Create some test data: C = cell(1, 5); for k = 1:5 C{k} = rand(4, 5); end M = cat(3, C{:}); % convert c...

8 years ago | 0

Answered
How can I modify vector length?
If cropping the zeros solves the problem, crop the zeros: v = [0,0,1,2,3,4] v = v(find(v, 1):length(v))

8 years ago | 1

| accepted

Answered
MAT-file size is changing a little when downloading files from SFTP-server to the computer
a = 1223022 b = 1194358 a / b >> 1.0240 This looks like the typical problem of defining "kB" by 1000 or 1024 Bytes...

8 years ago | 0

| accepted

Answered
problem with biosig toolbox
You get 3 different error messages. This is not a smart idea of the programmer. Either the format is unknown, or there is a prob...

8 years ago | 0

Answered
How to get output object name created by a method in caller workspace inside the method
This sounds like meta-programming: Using an indirect way around the standard channels to provide information. This would work e....

8 years ago | 1

| accepted

Answered
A way to reference questions and blog articles from your profile
I'm using the bookmarks of my browser for this. It is easy to synchronize them between different machines.

8 years ago | 0

Answered
Delay when resizing a figure in R2016b
The standard solution worked directly: Install the drivers from the Intel home page. In my case: <https://downloadcenter.inte...

8 years ago | 1

| accepted

Question


Delay when resizing a figure in R2016b
After resizing a figure, it takes 4 to 6 seconds until the contents is refreshed. This happens in Matlab R2016b under a freshly ...

8 years ago | 3 answers | 0

3

answers

Answered
Surf plot mesh looks jagged when I set FaceAlpha
It looks nice in my Matlab 2016b/Win10. Setting the Alpha blending enables the OpenGL renderer. If this causes troubles, try: ...

8 years ago | 0

Answered
ode45 command matlab help
Remember that Matlab's ODE integrators (as many other tools also) can handle smooth functions only: The automatic step size cont...

8 years ago | 2

Answered
Replace NaN with mean of previous values
You forgot to mention, which problem you have with the shown code. 1. |size(vector)| replies a vector. If |vector| is a row v...

8 years ago | 0

Answered
Pseudo coding a function help
# Some parameters are defined # The start point is set to |r0| and the initial velocity to |v(1,:)| # A loop runs over 10000 t...

8 years ago | 0

Answered
Dimension issue when recreating bmp image using imshow()
I'm sure that replacing the loops by |reshape| and/or |permute| would simplify the code (see Stephen's comment). But the actual ...

8 years ago | 0

| accepted

Answered
wait bar in MATLAB gui in nested FOR loop
MBTs = minMBT:stepMBT:maxMBT; MATs = minMAT:stepMAT:maxMAT; n = length(MATs) * length(MBTs); c = 0; H = w...

8 years ago | 0

| accepted

Answered
compare elements in a column and exit while loop
Perhaps with some guessing: A = rand(2, 2); B = rand(2, 3); % For the 2nd while loop: while ??? if any(A(:,...

8 years ago | 0

| accepted

Answered
How to stop legend adding data1 to figure when adding data from if statement
A general hint at first: Do not create a bunch of variables with numbered names. See <https://www.mathworks.com/matlabcentral...

8 years ago | 0

| accepted

Answered
Writetable() Error - Input must be a row vector of characters
What is your variable |location|? The 2nd argument must be the file name, which must be provided as row vector of type char. Che...

8 years ago | 0

Answered
combining multiple wav files into one multichannel matrix
Perhaps by something like this: S = struct(); iS = 0; Folder = 'C.:\Your\Folder\'; for k = 1:1000 str = spri...

8 years ago | 0

| accepted

Answered
finding instances of a string withinin a structure
match = reshape(strcmp({Markers.Description}, 's2'), size(Markers)); Now |match(i,j)| is TRUE, when the struct |Markers(i,j...

8 years ago | 3

| accepted

Answered
I am trying to get all 20 random points to have random velocities
The code is still not clear. You define function [Vx,Vy,Vz] = velocities_fun(x,y,z) Vx=normrnd(1,1); Vy=normrnd(1,1);...

8 years ago | 0

Answered
Matrix indexing nearest neighbour
a = [1 3 5; 3 5 7; 4 7 8]; c = zeros(10, 3); [s1, s2] = size(c); c(a + s1 * (0:s2-1)) = 1 % >= R2...

8 years ago | 0

| accepted

Answered
Grouping repetead values in cells
% Some test data: a = [1;2;1;2] B = rand(560800, 20); B(:, 1) = randi([1,2], 560800, 1); % Distribute B ov...

8 years ago | 1

Answered
load being 3x faster than importdata
As you see |load| is faster than |importdata| for a MAT files. To save time and energy use |load|.

8 years ago | 0

| accepted

Answered
Try to display a different image on an axes everytime I click on the axes
This happens, because the mouse click event is caught be the object in the foreground, the image. It _steals_ the event and does...

8 years ago | 0

| accepted

Answered
minimum not zero in row
The argument Dmat(~ismember(Dmat(i,1:7),0)) considers the first column only. You want: Dmat(c, ~ismember(Dmat(i,1:7...

8 years ago | 0

| accepted

Load more