Answered
How do I find a folder with a specified string?
The problem is that |listing.name| expands to a <https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html co...

9 years ago | 0

| accepted

Answered
Why does dir .name output have two answers but numel reports only one element?
Here is an in-depth discussion of exactly this behavior: <https://www.mathworks.com/matlabcentral/answers/344486-generate-com...

9 years ago | 1

| accepted

Answered
Extracting character before point (.)
This is easy using <https://www.mathworks.com/help/matlab/ref/regexp.html |regexp|>: >> C = {'KT2.5FDR';'CB6.456';'DFRG8.9B...

9 years ago | 0

| accepted

Answered
How to check if output argument is ignored?
No, it is currently not possible without writing some hack with |dbstack| and parsing the calling file. See also: <https://ww...

9 years ago | 1

| accepted

Answered
.mat files with the same data are different
|.mat| files include a timestamp, so the binary files will clearly be different if they were created even just one millisecond a...

9 years ago | 0

| accepted

Answered
Is it possible to extract numbers from formated strings without a for cycle?
Much faster than |cellfun|, |str2double|, or |strrep|, and with no explicit loop: >> C = {'abc12', 'abc23', 'abc24', 'abc99...

9 years ago | 3

| accepted

Answered
How to search a substring in a list of strings?
Much faster than using |cellfun| or any string functions: >> C = {'xx', 'abc1', 'abc2', 'yy', 'abc100'}; >> Z = C(strncm...

9 years ago | 1

Answered
could anyone tell me how to replace the value of the given matrix
This is trivially easy with <https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum |randfixeds...

9 years ago | 1

Answered
Import function; not able to index in for loop. How to save variables as filenames?
_"My problem is in the for loop."_ Yes, it is. _"... my loop reads all the datafiles as tables, but doesnt save them as in...

9 years ago | 0

Answered
DECIMAL To Binary Representation
Where |N| is an integer: >> N = -24; >> V = pow2(1+fix(log2(abs(N))):-1:0); >> Z = fix(mod(abs(N),V(1:end-1))./V(2:en...

9 years ago | 0

Answered
Mapping of a random number in one range to another range
A trivial solution using <https://www.mathworks.com/help/matlab/ref/interp1.html |interp1|>: >> num = 2.3; >> interp1([0...

9 years ago | 5

| accepted

Answered
What's wrong with this code?
Your basic idea is okay, but a few tweaks would make the code simpler and more robust. Because there is a clear practical limit ...

9 years ago | 0

| accepted

Answered
String and character array not properly printing
Two things happen here: <https://www.mathworks.com/help/matlab/ref/input.html |input|> actually only accepts a character *vector...

9 years ago | 0

| accepted

Answered
program that returns random letter
char(randi([65,90])) char(randi(+'AZ'))

9 years ago | 3

| accepted

Answered
Delete row from struct on string condition
You should simply use <https://www.mathworks.com/help/matlab/ref/ismember.html |ismember|>: idx = ismember({PaxUsage_struct...

9 years ago | 2

| accepted

Answered
Finding longest consecutive numbers in array
V = [1999,2000,2001,2003,2004,2005,2006,2007]; D = diff([0;diff(V(:))==1;0]); B = find(D>0); E = find(D<0); [~,idx] = max(E-...

9 years ago | 0

| accepted

Answered
Help, i wrote these files over here to process a series of files ended with .mat, however, the matlab doesn't read it according to the order but randomly, why is it ? i am so desperate!!!
The order is NOT random, but it is in fact the order returned by your OS. If you have numbers in the filenames and want them sor...

9 years ago | 0

Answered
I have a 4x5 matrix (D) and I want to assign each column to a variable to call the columns out. How would I do so?
Why not simply use indexing (faster and more efficient than converting to cell, etc): n = D(:,1); s = D(:,2); B = D(:...

9 years ago | 2

Answered
how to modify a double whose name is stored as a string in another cell
_"Basically I am trying to merge abc_1, abc_2 and abc_3 into abc_1 and than delete abc_2 and abc_3. Not sure how am I suppose to...

9 years ago | 0

Answered
How to adress string within cell array?
You have a 1x1 cell containing a 5x1 cell, so all you need is this: str2double(T{1}{5})

9 years ago | 0

| accepted

Answered
Could anyone help me to fix the issue.
_"If A=rand(5,10) how to have the values by fixing the minimum value to be 0.01 and maximum value to be 0.09 and by adding all t...

9 years ago | 3

Answered
How to remove numbers from a cell array
A trivial implementation using <https://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|>: D = regexprep(C,'[\d...

9 years ago | 2

| accepted

Answered
Error using fopen The file name contains characters that are not contained in the filesystem encoding.
The first character of the filename is a non-printing character (possibly a <https://en.wikipedia.org/wiki/Control_character con...

9 years ago | 1

| accepted

Answered
How to create a function of matrix with integer(from 1 to infinite) that can be arranged by row and column
Depending on the orientation you are after, either: reshape(1:m*n,m,n) or reshape(1:m*n,n,m).'

9 years ago | 0

| accepted

Answered
How to load a variable name from one function to another?
_"How to load a variable name from one function to another?"_ By far the simplest and most efficient way of doing this is to ...

9 years ago | 0

Answered
subtract values inside a array
MATLAB code should be beautiful, simple, and efficient: >> V = [12;2;6;8;6;2;12]; >> 50+cumsum(-V) ans = 38 ...

9 years ago | 1

| accepted

Answered
Division inside an array
>> fri = 1:3; >> j = 0:6; >> bsxfun(@rdivide,j(:),fri) ans = 0.00000 0.00000 0.00000 1.00000 0.5000...

9 years ago | 0

| accepted

Answered
Need to remove punctuation from a string that was pulled from a cell array
It is so much simpler to use <https://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|>: out = regexprep(inp, '...

9 years ago | 0

Answered
Saving data from loop
*method one: concatentation:* z = []; while ... ... pie = ... z = [z,pie]; end *method two: inde...

9 years ago | 0

| accepted

Answered
View a 3D matrix
You could use <https://www.mathworks.com/help/matlab/ref/scatter3.html |scatter3|>: S = size(A); [X,Y,Z] = ndgrid(1:S(1)...

9 years ago | 4

Load more