Answered
Saving values in a vector inside a loop, and finding the specific loop at which a certain element is saved
A few thoughts: * There is a potential problem in your code as you set the loopcounters s and t to a value within the loop. ...

8 years ago | 1

Answered
control for-loop index using a gui slider
My first recommendation would be to use an infinite while loop. Fo starters, in pseudocode: function StartButtonPressed ...

8 years ago | 0

| accepted

Answered
Why, when I pass a structure S into a function, and assign or update more fields to it, does it remove the fields it had when entering the function?
I suspect you have a _clear all_ statement (or _clear S_) inside your function ...

8 years ago | 0

Answered
loop becomes terminated after i=1 it is not continuing
i loops from 1 to nb-1, so ... did you check the value of nb?

8 years ago | 2

| accepted

Answered
How can I change pixel color of particular X and Y coordinates easily?
Having a lot of variables labeled A1, A2, A3 etc. in your workspace that are related is generally a very bad idea, inducing lots...

8 years ago | 0

| accepted

Answered
Pause code while importing data
Using an output of uiimport will stall execution of later code. S = uiimport('-file') disp('Import finished.') % an...

8 years ago | 0

Answered
Too many plots..too little time!!
why don't you try *histogram* and use the help to improve the plot, add a fit etc. n = 10+5*randn(1,100) ; histogram(n)

8 years ago | 1

Answered
Column Indexing and help finishing function
You want to update a single column, but keep the rest! You can do this by indexing on the left hand side of the assignment opera...

8 years ago | 0

Answered
Finding Continuous missing values (NaN) from a matrix
I am not sure what you mean by " _count the amount of continuous NaN's_". Do you want know total number of NaN values in X? The ...

8 years ago | 0

Answered
Real-Time Eye Tracking ... help!
You could perform some kind of mapping from eye position in the camera to the coordinates on the screen, that is, a calibration....

8 years ago | 0

Answered
When I start and end a function. I get the error ('local function has the same name as file'). can anyone help with this. Thank you
_function_ should be the *first word* in the m-file that defines the function! (remove the clc and clear)

8 years ago | 0

| accepted

Answered
How to count the number of consecutive identical elements (in both the directions) in a binary vector ?
Something like this? X = [0 0 0 0 1 1 1 0 1 1 1 1] % row vector! numX = numel(X) ; Q = find([false diff(X)...

8 years ago | 1

Answered
Dividing data set into subsets and plot them on same graph, with individual trend lines
% create artificial data N = 6 ; % number of data sets M = arrayfun(@(k) polyval([randi(10) 2*k], 1:10), 1:N, 'un',0) ;...

8 years ago | 0

Answered
how to create this matrix [1 2 3 4 5;2 2 3 4 5;3 3 3 4 5;4 4 4 4 5;5 5 5 5 5]
% data n = 7 % "order" % engine x = repmat(1:n,n,1) x = max(x, x.') _Added after comment:_ for non-square...

8 years ago | 0

| accepted

Answered
How can i get almost similar row from amatrix
You have to define "similar" more strictly! Here I have take the norm as the similarity measure, but there are other alternative...

8 years ago | 0

Answered
Keep the value of randperm after clear all
* learn to use functions rather than scripts, pass the variables needed for the second function as arguments. No need for clear ...

8 years ago | 0

Answered
Create multidimensional matrices from two multidimensional cells.
The operator * may not do what you expect. Try this A = [1 2 3] ; B = [4 5 6] ; C = [10 20 30 40 50] % A * B % error ...

8 years ago | 0

Answered
How can I change pixel color of particular X and Y coordinates easily?
transform the subindices into linear indices using sub2ind [r,g,b] = deal(0.5 * ones(10)) ; % example image x = [2 4 6 3...

8 years ago | 0

Answered
find nonzero minimum element in a matrix
Why not set the values to Inf, rather then zero? Or to Nan and use nanmin instead? To find the overall minimum of a matrix M ...

8 years ago | 0

| accepted

Answered
How can I replace values in an array with the value in the previous column's value?
Somewhat simpler: n = zeros(1,4) ; % array of specific length while (1) % i...

8 years ago | 1

| accepted

Answered
Dividing a set of numbers into set of intervals and caculating the mean of each interval and comparing it with the previous one
I understood your question somewhat different: "I have N numbers {x(1) x(2) ... x(N-1) x(N)} and want to split them into several...

8 years ago | 1

Answered
Hey guys. Could use some help in obtaining output from the cell array.
Like this? output = {'X123','X456','X789'} MyStringOutput = ['sometext ' sprintf('%s ',output{:}) 'moretext']

8 years ago | 0

| accepted

Answered
single vs multiple fprintf() efficiency
You can skip the format identifier for string inputs, simply because fprintf uses the format identifier to transform its inputs ...

8 years ago | 0

Answered
uncertainty in linear fit
Unfortunately, the first output of the function polyfit, being the coefficients of the fit changes, with the requested number of...

8 years ago | 0

Answered
Simple if else function
You should call the function like this [out1, out2] = inertimoment('rektangel', 3, pi) By the way, the else in your cod...

8 years ago | 0

| accepted

Answered
Creating a matlab shortcut to create a matlab script file with the assignment name and a certain header.
insert this before the first fprintf fid = fopen(s, 'wt') ; if fid == -1 return end and end your script with...

8 years ago | 0

Answered
offset matrix multiplication with loop
% test data A = randi(10,3,4) B = cumsum(ones(size(A))) % engine C = A(2:end,:) .* B(1:end-1,:) % C(i,j) = A(i+...

8 years ago | 1

| accepted

Answered
How to exclude rows on the basis of specific entries?
Here is a flexible example: % data X = [4 4] ; % rows starting with this should be discarded A = [1 4 1 4 ; 4 4 2 2 ;...

8 years ago | 0

Submitted


nchoosecrit(S, FUN)
returns those subsets (= combinations of elements of a set) that fulfill a specific criterion

8 years ago | 1 download |

5.0 / 5

Answered
How can we Evaluate performance from confusion matrix ..........? using true positive and true negative etc.
The definitions are all over the internet, for instance, here: <http://www.dataschool.io/simple-guide-to-confusion-matrix-ter...

8 years ago | 0

| accepted

Load more