Answered
Is there any short cut key to change m-files that are open on the editor section?
ctrl + page up ctrl + page down <https://www.mathworks.com/help/matlab/matlab_env/keyboard-shortcuts.html>

9 years ago | 1

| accepted

Answered
Help with Sorting cell
Download my FEX submission <https://www.mathworks.com/matlabcentral/fileexchange/34464-customizable-natural-order-sort |natsort|...

9 years ago | 1

| accepted

Answered
Coverting "numeric" strings in cell to numbers
Loops are not required, because |str2double| works extremely efficiently on a cell array of strings. Thus a more efficient solut...

9 years ago | 2

Answered
How to handle empty strings with datenum
Just avoid passing them to |datenum|: >> C = {'1988-06-03';'';'2018-03-03'}; >> idx = ~cellfun('isempty',C); >> out =...

9 years ago | 1

| accepted

Answered
how to write a1=1;a2=2;a3=3; from A
*Do NOT do this* This would actually be horribly slow, pointlessly complex, obfuscated, and very buggy way to write your code...

9 years ago | 2

| accepted

Answered
Interpolation for 1-D, 2-D, 3-D, and N-D gridded data in functionformat
ND curve-fitting is not really a trivial task. You can easily define a _"black box or fucntion as the way you can input value an...

9 years ago | 0

Answered
Passing a vector as multiple inputs to a function
_"Is there a way to convert a vector of values into seperate function inputs so that this will update automatically"_ Yes the...

9 years ago | 3

| accepted

Answered
match on a string
Putting numeric data into a cell array makes it harder to process. Converting to numeric using |str2double| is reccomended rathe...

9 years ago | 1

Answered
counting pattern frequency in a string
Hummm, interesting problem. I would approach this slightly differently, taking advantage of two features to try and achieve some...

9 years ago | 1

| accepted

Answered
searching row indices in a matrix
Use <https://www.mathworks.com/help/matlab/ref/strfind.html |strfind|> if you want to preserve order. It will return the first i...

9 years ago | 0

Answered
Find repeated expression in array of strings, return logical.
Here is one solution based around <https://www.mathworks.com/help/matlab/ref/cumsum.html |cumsum|>: % Data: LF = {'apple...

9 years ago | 1

| accepted

Answered
Plot rectangular square wave
If you want a "perfect" square wave (which is of course physically impossible), then you could simply plot two points at each di...

9 years ago | 1

Answered
Adjusting slider to scroll trough each image in 3D stack in GUI
Change the order in which you specify the parameters: set(handles.hslider, 'Value', 1, 'Min', 1, 'Max', numel(filenames), ....

9 years ago | 0

| accepted

Answered
Returning Variables as Characters
*method one: character code:* >> b = char(66-(a<0.4)) b = ABBBBBAABA *method two: |sprintf|*: >> b = sprintf(' %...

9 years ago | 3

Answered
Ismember to replace value in vector?
Read the <https://www.mathworks.com/help/matlab/ref/ismember.html?s_tid=gn_loc_drop |ismember|> help, the second output is all y...

9 years ago | 0

| accepted

Answered
Finding cells with specific string in cell array and substituting them
Using |find| is not required, and just makes it much more complex. All you need is to use logical indexing: idx = strncmpi(...

9 years ago | 1

Answered
How to solve Error using repmat
>> B = reshape(repmat(max(reshape(C,2,[])),2,1),size(C)) ans = 0.17380 0.00000 0.02440 0.00000 0.02600 0.0240...

9 years ago | 0

Answered
How to rearrange data in matrix ?
>> A = 1:15; >> reshape(A,5,3).' ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14...

9 years ago | 0

| accepted

Answered
Creating a 4D array.
cat(4,P_3D,t_n)

9 years ago | 0

Answered
Union of two matrices with different column size
>> [idm,idn] = ismember(M(:,1:2),N(:,1:2),'rows'); >> N(idn,3) = M(idm,3); Note that the provided data are floating poin...

9 years ago | 0

| accepted

Answered
How can i decode an array following some conditions?
*method one: median:* >> y = [0,1,0,0,1,1,0,0,1]; >> median(reshape(y,3,[])) ans = 0 1 0 *method two: ro...

9 years ago | 1

| accepted

Answered
Adding functions of the same variable to form a new function
To add normal MATLAB functions simply define a new function: f3 = @(x) f1(x) + f2(x);

9 years ago | 3

| accepted

Answered
Isempty in while loop not working
_"this might be a rookies mistake"_ It is. The mistake occurs here: alpha==angle Small differences in the floating-po...

9 years ago | 0

| accepted

Answered
sharing of numbers in the matrix
Solution to your original question: >> reshape(repmat(max(reshape(A,2,[])),2,1),size(A)) ans = 0.10000 0.00000 ...

9 years ago | 1

Answered
How to use rgb2cm.m
Download the function from FEX, and follow its instructions: <https://www.mathworks.com/matlabcentral/fileexchange/35469-rgb2...

9 years ago | 0

Answered
How can I search for a specific piece of text in a cell array and output the element corresponding to it from a column vector?
Use indexing: >> C = {'berlin';'dublin';'jakarta'}; >> V = [1;22;333]; >> idx = strcmpi('dublin',C); >> V(idx) ...

9 years ago | 0

| accepted

Answered
All functions in a script must be closed with an 'end'.
You need to remove the |g|: g%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

9 years ago | 2

Answered
Applying mean to multidimensional matrix leads to disappearance of dimension
Actually the output array really _does_ have size 66 52 33 15 8 1 but MATLAB simply does not display tr...

9 years ago | 0

Answered
How to write a function with a number of outputs which is governed by a number of inputs?
You can easily use |varargin| and |varargout| to do this: function varargout = funname(varargin) varargout = varargin; %...

9 years ago | 3

| accepted

Answered
Not enough input arguments
Your comment shows that you have provided the function handle as a callback function to some GUI object. When you read the docum...

9 years ago | 0

Load more