Answered
How I can separate number behind comma in columns at cell array
Download Jos's excellent <https://www.mathworks.com/matlabcentral/fileexchange/22909-padcat-varargin- |padcat|> from FEX: >...

9 years ago | 0

| accepted

Answered
How can I loop through a large amount of images, generating and saving a figure for each one, without getting memory bloat and cryptic error messages?
You continuously create new figures, and never close them. Clearly this will use increasing amounts of memory. This is not a bug...

9 years ago | 0

| accepted

Answered
When the variable name is changed, it gives error
I bet if you looked at the value of |ExpN_no| it is zero. The cause will be that there are no files matching that pattern in ...

9 years ago | 0

| accepted

Answered
Creating an array or sym for n many state variables in Symbolic Math Toolbox
<https://www.mathworks.com/matlabcentral/newsreader/view_thread/255948> <https://www.mathworks.com/matlabcentral/answers/3505...

9 years ago | 0

Answered
combine two double cells into 1
>> C1{1} = [1,2,3,4]; >> C2{1} = [5,2,3,7]; >> C1{2} = [1,2]; >> C2{2} = [4,5]; >> Z = cellfun(@(a,b)unique([a,b])...

9 years ago | 1

| accepted

Answered
Saving a logical mask
Simply <https://www.mathworks.com/help/matlab/ref/save.html |save|> it in a |.mat| file: save('nameOfFile.mat','nameOfVaria...

9 years ago | 2

| accepted

Answered
Finding the particular pattern from cell array
>> A = {'file.m', 'file.log', 'file_dsaf_dsfaf.log', 'data.log'}; >> idx = cellfun('isempty',regexp(A,'^fi.*log$')); >> ...

9 years ago | 2

| accepted

Answered
manipulating three dimensional cell arrays
Use <https://www.mathworks.com/help/matlab/ref/cellfun.html |cellfun|> and <https://www.mathworks.com/help/matlab/matlab_prog/ac...

9 years ago | 1

| accepted

Answered
How can I store a value from each iteration of a for loop, ready for plotting?
You should preallocate the output array and use indexing to put the values into it. In this example I also create an array for t...

9 years ago | 0

Answered
how remove words from a cell array
>> A = {'past';'life';'amp';'thinks';'hes';'cat\udd\udc';'https\u';'itsyaaboysb';'somebody'}; >> idx = cellfun('isempty',st...

9 years ago | 1

| accepted

Answered
value from string ?
@Ole: putting your values into lots of separately named variables called |x1|, and |x2|, etc, is a really bad way to write code....

9 years ago | 1

| accepted

Answered
How to randomly generating a function with math operators and operands
This is MATLAB, so there is no point in writing slow and ugly nested loops and using |switch| statements when <https://www.mathw...

9 years ago | 2

Answered
what does :: mean and why is it not recognized by MatLab
The |::| indicates that it is NOT a MATLAB command, but is used in MuPAD (the symbolic math engine): <https://www.mathworks.c...

9 years ago | 0

Answered
determine which cells have more than 1 row
cellfun('size',sectout,1)

9 years ago | 1

| accepted

Answered
Concatenate cell arrays from structs
You could use <https://www.mathworks.com/help/matlab/ref/struct2cell.html |struct2cell|>: C = struct2cell(output); C = v...

9 years ago | 1

Answered
How can I get my code to speak with a voice
There is nothing built-in. Try downloading these: <https://www.mathworks.com/matlabcentral/fileexchange?term=tts> Note tha...

9 years ago | 1

Answered
How to move array data to additional columns based on repeats in a vector or column
Creating new columns would not be trivially simple without expanding the array continuously. A simpler solution is to put the gr...

9 years ago | 1

| accepted

Answered
How to apply arrayfun on a 3D matrix?
_"How can I do this via arrayfun, and not through for-loop?"_ You can't, because |arrayfun| operates on each element of an ar...

9 years ago | 0

| accepted

Answered
how to convert character array to cell array
num2cell(reshape(X.',1,[]))

9 years ago | 0

| accepted

Answered
Rearranging of matrix in order to avoid loop
>> II = repmat(permute(ii,[2,3,1]),1,10,1); >> JJ = repmat(permute(jj,[3,2,1]),10,1,1); >> rex = E(sub2ind(size(E),II,JJ...

9 years ago | 0

| accepted

Answered
How should I solve the "output argument not assigned" problem(GUI function)?
function threshold_value = get_threshold_value(raw_image) threshold_value = []; figure_handle = figure(...); ... w...

9 years ago | 1

| accepted

Answered
How do you change a variable in the workspace with a push button?
Nested functions are simpler and faster (untested): function doesnotfit % I = 0; fgh = figure('position',[1100,30,...

9 years ago | 0

Answered
I want to access every nth value of a large matrix. How can I do that?
Where |M| is your matrix, using simple subscript indexing: M(1:9:end,1:9:end) Or using linear indexing (not likely that ...

9 years ago | 1

| accepted

Answered
Automatically update a string in GUIDE textbox
You will need to set the text string inside the loop. For example (untested): function stopwatch(h) for k = 1:10 ...

9 years ago | 0

Answered
How to convert a matrix of cells to a regular matrix
Without changing the original cell array: >> C = {8.456,[],[],9.456,6;[],[],7.89,[],6.876;[],5.79,5,[],[]}; >> out = zer...

9 years ago | 2

| accepted

Answered
How do I map the elements of one matrix to another?
If |b| has 1024 rows then you will need: 1+1024-y otherwise the lowest calculated index value will be zero (MATLAB index...

9 years ago | 1

| accepted

Answered
creating matrices in a loop
_"My intention is to get u_1,u_2,...,u-5. ... Can anyone help in this regard"_ Do not do this! While it _is_ possible to m...

9 years ago | 0

Answered
Alternative naming for variable
What is wrong with simply doing this? tmp = m(:,:,3); tmp(:) or using |reshape| ?

9 years ago | 1

| accepted

Answered
Plot multiple Lines and keep them in one handle
Plotting in a loop is a waste of MATLAB: tol1 = [2 3,4,5,6,7,8]; tol2 = [1,2,3,4,5,6,7]; x = [1,2,3,4,5,6,7]; lnh ...

9 years ago | 6

| accepted

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Magically Making Variables Appear in a Workspace is Risky This leads to many subtle bugs that are extremely difficult to track ...

9 years ago | 7

Load more