Answered
Matrix linear indexing: how to add more than once to the same index
Another option, possibly faster than a loop or |unique| + |histc|: A = [10 20;30 40]; idx = [1 3 1]; A(:) = A(:) ...

10 years ago | 2

| accepted

Answered
Illegal use of reserved keyword "else".
Short answer: get rid of all the |...| Long answer: I assume that at some point, the stuff after the |...| was on a second l...

10 years ago | 1

Answered
How to find the 4 most extreme values in each column of a matrix
[~, index] = sort(abs(A), 'descend'); absmax = A(sub2ind(size(A), index(1:4, :), repmat(1:size(A, 2), 4, 1)));

10 years ago | 0

| accepted

Answered
Compatibility or syntax issue while running a 2014 script ?
function ... = ...(x, *'chrI'*, xx, 'VC_chr1.fa', 'TA') This has never been valid syntax in matlab. Neither |*| nor |'| can...

10 years ago | 0

Answered
How to remove zeros using Function in Matlab?
Considering that the nans you want to remove are the ones you put there on the previous lines, why put the nans in the first pla...

10 years ago | 0

| accepted

Answered
Creating a matrix using loop for and if
A loop is completely unnecessary: B = A; B(B>360) = B(B>360) - 360; Using a loop, this would have been the proper syn...

10 years ago | 0

| accepted

Answered
How do I create a vector array out of certain values of a matrix?
The <https://www.mathworks.com/help/matlab/ref/triu.html |triu|> function can be used to create the logical matrix for the mask ...

10 years ago | 1

Answered
Insert underscore into the string
Using |regexprep|, this would be one of the many ways to do it: a = regexprep(datestr(now, 31), '..(..)-(..)-(..) (..):(..)...

10 years ago | 1

| accepted

Answered
which one is better for image processing use openCV with matlab OR openCV with GCC/visual studio? with respect to 1) speed 2) performance 3) ease of coding
A well written C++ program using openCV is probably going to be faster and more performant than a good written program doing the...

10 years ago | 0

| accepted

Answered
Interpolation problem with NaN numbers
Use John D'Errico's excellent <http://uk.mathworks.com/matlabcentral/fileexchange/4551-inpaint-nans inpaint-nans>.

10 years ago | 0

Answered
Does matlab 2016a implementation of sqlite interface respect foreign key constraints?
The |sqlite| interface is <http://uk.mathworks.com/help/database/ug/working-with-the-matlab-interface-to-sqlite.html severely li...

10 years ago | 1

| accepted

Answered
Matlab Mutiple Text Files, Plot
Well, the error message is very clear: Error using plot. Vectors must be the same length Error in [..] plot(Column4, Calc...

10 years ago | 0

| accepted

Answered
How can i find the path of a file?
_"so i can add this file to my current folder and open it with fopen()"_ That is completely unnecessary. You don't need to (a...

10 years ago | 0

Answered
Could not start Excel server for import
Matlab is telling you it can't talk to excel. Since you upgraded Windows, it's possible that it messed up the excel installation...

10 years ago | 0

Answered
i want to make a function file for finding log of positive number to base 3! how do i do it?
It's really <https://en.wikipedia.org/wiki/Logarithm#Change_of_base basic maths>: log3 = @(x) log(x) / log(3) log3(3^1...

10 years ago | 1

Answered
Import excel file destroy the date vector and convert them to numeric number
On a Windows computer with excel installed, matlab talks directly to excel to load the file. On a Windows computer without excel...

10 years ago | 0

Answered
A cropped image that has a single object that has been thresholded and converted to binary image. Is it best to use regionprops to find the area of that image or some other method?
If there is only one object in the binarised image, then |sum(binaryimage)| will be marginally faster than using |regionprops|. ...

10 years ago | 0

| accepted

Answered
if a=[1,2,3,4] how can i get b=[ (1+2),(1+3),(1+4),(2+3),(2+4),(3+4) ] using for loops,Thanks
Here's an answer without a loop. More efficient! a = 1:4 b = sum(nchoosek(a, 2), 2) %use nchoosek(a, 2) to create [1 2;...

10 years ago | 1

Answered
Finally Clause in Try-Catch
Yes, there's no finally in matlab. It remains to be seen if raising exceptions have an impact or not on execution speed. It's...

10 years ago | 3

Answered
How to remove additional rows from a matrix?
Note: you're taking a risk using |length| with a matrix. |length| is the size of the largest dimension so could be the number of...

10 years ago | 2

| accepted

Answered
Returning Mapped Directory from a specific subst drive
I'm not sure why you introduced brackets |[]| in your regular expression. That is one of the issue. A bracket expression means m...

10 years ago | 0

Answered
Create new column in cell array based on string values in other columns
Use |strjoin| to merge the strings and a loop to go over the rows: C = {'aaa', 'b', 'cccc'; 'string1', 'string2', '...

10 years ago | 0

| accepted

Answered
How to remove a whole row of data?
Assuming that A and X are indeed cell arrays (see comment to the question): A = {'SAH'; 'SAE'} X = {'2', 'BAH', 'CAE'; ...

10 years ago | 0

Answered
M-script to determine if user has administrator rights
Because access permission is such a complex beast on Windows, the best way to check if the user can do something is simply to at...

10 years ago | 1

Answered
Find index of cells containing a string
The problem is not with your search expression, which works fine, but the fact that the exact string 'CERT' is not present in yo...

10 years ago | 0

| accepted

Answered
Extracting data from a table
This is basic table filtering: resttable = TestTable(TestTable.Phase == 'REST', :) %select only those rows that are REST a...

10 years ago | 2

| accepted

Answered
How to get connected component from adjacency matrix
A lot of graph functions have been added in R2015b. In particular, you have <http://www.mathworks.com/help/matlab/ref/graph.conn...

10 years ago | 0

| accepted

Answered
Comparing Contents of Two Matrices
all(ismember(A, B))

10 years ago | 2

| accepted

Answered
Struggling to store indexing variable as an array.
Each character of a string is one element of an array. So |File = zero(1, 10)| will only let you store 10 characters, not 10 str...

10 years ago | 0

| accepted

Answered
Input as the hexadecimal number
Unfortunately, there is no support for hexadecimal literals. The best you can do is: a = hex2dec('3656174'); b = hex2dec...

10 years ago | 0

| accepted

Load more