Answered
how to create a matrix from specific Cell array elements?
Where C is your cell array: cell2mat(C(1:2,1:2))

10 years ago | 0

| accepted

Answered
Check the existence of a directory based on part of a string?
The simplest option is to use dir directly to return only directory names that match that pattern. You might also want to sort ...

10 years ago | 0

| accepted

Answered
Matlab can gca and gcf replaced?
The simplest way is to read the documentation, and you will find that every graphics function returns the handles of the graphic...

10 years ago | 3

Answered
How to avoid multiple file load in GUI?
Every function (including callback functions) has its own <http://www.mathworks.com/help/matlab/matlab_prog/base-and-function-wo...

10 years ago | 0

| accepted

Answered
problems with matrix splitting
Use |accumarray|: out = accumarray(A(:,1),A(:,2),[],@(v){v})

10 years ago | 1

Answered
How do you specify special character using ASCII code in a textscan format string?
The task of encoding non-printing characters by writing printing characters is typically solved by using special characters. In ...

10 years ago | 0

Answered
Globalsearch not working for a function file.
Lets start by reading the error message: _"Supplied objective function must return a scalar value"_ So, the objective functio...

10 years ago | 0

| accepted

Answered
Display the content of the cell array
>> sprintf('The selected cars are:%s',sprintf(' %s,',a{:})) ans = The selected cars are: Ford, AUDI, Or if you do not wa...

10 years ago | 1

| accepted

Answered
how to share data between different m files
This is easy: # make sure that you only <http://www.mathworks.com/help/matlab/matlab_prog/scripts-and-functions.html write fu...

10 years ago | 0

Answered
retrieve single element in cell array
In just one line, where |array| is your cell array: out = cellfun(@(m)m(2,1),array)

10 years ago | 0

Answered
how to normalize data between 0 and 1 , each column?
This will normalize each column (assuming no NaN, Inf, or complex): x = [min(a,[],1);max(a,[],1)] b = bsxfun(@minus,a,x(...

10 years ago | 3

| accepted

Answered
How to Convert a Logical Vector to a Character Vector?
>> A = [0,1,0,1,1,1]; >> X = {'no','yes'}; >> B = X(1+A) B = no yes no yes yes yes *Note about "Character Vector":...

10 years ago | 9

| accepted

Answered
Selecting sequence of data of column vector
Just use indexing: sum(vector(1:5:end)) This is very basic MATLAB usage, which is taught well in the introductory tutoria...

10 years ago | 1

Answered
Merging adjacent cells in a cell array and applying rules to remove entries
This actually provides the requested output: C = {[-2,-1], [1,-2]; [1,-2], [2]; [1,-2,-1], [1,2]}; D = cellfun(@(c)[c{:}...

10 years ago | 0

Answered
How do I change a function input with each loop iteration?
You are making your code far too complicated for such a simple task. Keep it simple, something like this should work: S = d...

10 years ago | 0

| accepted

Answered
How to load texfile with lots of emptydata values?
This reads the file (attached): opt = {'Delimiter','\t', 'HeaderLines',1}; fmt = repmat('%s',1,8); fid = fopen('Rockf...

10 years ago | 1

| accepted

Answered
Hi, I want to reach to matrix B from matrix A with this property. can anyone help me?
No doubt there are ways using image processing toolbox functions, but here is one solution that does not require any toolboxes a...

10 years ago | 0

| accepted

Answered
How can I store the output of a function in a seperate matrix?
*You do not need to call this function in a loop* Get rid of the loop when you call the function. You don't state this in ...

10 years ago | 1

| accepted

Answered
Writing a Nth order matrix.
Just keep it simple: >> a = 1:5; >> M = diag(ones(1,numel(a)-1),1); >> M(end,:) = a M = 0 1 0 0 0 ...

10 years ago | 0

| accepted

Answered
Is it possible to extract all fields from a structure automatically?
You seem intent on magically making variables pop into existence in the workspace, so here is probably the least-worst way of do...

10 years ago | 9

| accepted

Answered
Matlab: Export concatenation of cell arrays into a txt file
The strings are nested in a different number of cell arrays. The string in |Only_Data| are nested in three layers of cell arrays...

10 years ago | 0

| accepted

Answered
Create matrices of all possible combinations of vectors
Simply define all of the vectors in one variable, here I called it |inp|: inp = {'A','B','C'}; % Put your vectors here. ...

10 years ago | 0

| accepted

Answered
Factorial Function Setting problem
There is nothing wrong with your function, it works fine: >> my_factorial(3) ans = 6 The problem is how you are call...

10 years ago | 0

Answered
Finding maximum and minimum
If you have the Signal Processing Toolbox then you can use <http://www.mathworks.com/help/signal/ref/findpeaks.html |findpeaks|>...

10 years ago | 1

Answered
How do i convert scientific notation into number in matlab
The variable |a| is already a numeric: >> a = 9.22222e+15 a = 9.2222e+015 >> isnumeric(a) %check that it is a numeric...

10 years ago | 1

Answered
Convert Numbers to letters
There is no inbuilt MATLAB function that converts numeric values to words, but you can use my FEX submission |num2words| to do e...

10 years ago | 2

Answered
convert "Jul_26_2016__11-26-37_AM" to Date Vector
According to the <http://www.mathworks.com/help/matlab/ref/datevec.html |datevec|> documentation (did you read it ?) you can sim...

10 years ago | 0

| accepted

Answered
Merge Odd and Even Text Files into One File Separately
Although your question does not state clearly what the problem is, I guess it is related to splitting the filenames into the two...

10 years ago | 0

Answered
batch processing unknown number of txt files
Of course you can batch-process using MATLAB: S = dir(fullfile(pathname,'*.txt')); out = cell(size(S)); for k = 1:num...

10 years ago | 0

| accepted

Load more