Answered
Is it possible to identify variables in the workspace that contain a string and save the identified variable with another name?
Assuming that you are LOADing some MAT files, then the best approach is to avoid your situation entirely, for example by LOADing...

2 months ago | 0

| accepted

Answered
padding an array with zeros in between elements
Assuming that A is sorted, here is a simple approach: A = [7,15,21,29]; B = A(1):A(end); B(~ismember(B,A)) = 0 If A is not s...

2 months ago | 1

| accepted

Answered
Read and Sort Large Amount of Audio .wav Files
As far as I know, the only way to get get the correct order DATASTORE filenames without affecting other properties/attributes is...

2 months ago | 1

Submitted


Convert between RGB and Color Names
RGB to color name. Color name to RGB. Supports many palettes: CSS, dvips, HTML, MATLAB, RAL, SVG, X11, xcolor, xkcd,...

2 months ago | 21 downloads |

Thumbnail

Answered
MATLAB null conditional operator
"How it could be done in most simple and elegant way?" I assume that the aim is to not change the logging calls within the proj...

2 months ago | 2

Answered
Error Message "Array indices must be positive integers or logical values" from importing .txt file and get plot
plot(time, Ion,'fileNames', fileNames{fileidx-1}); % ^^ get rid of this

2 months ago | 0

Answered
I have it reading from a struct with signal names and I want to extract it and input it into a 1 column array
The solution depends on the sizes of MESSAGES and SIGNALINFO (you did not tell us either of these). Perhaps this: out = {Messa...

2 months ago | 0

Answered
How to call a MATLAB variable loaded in from a .mat file when you don't know the name of the variable beforehand
"The easiest way would be to use eval():" Use STRUCT2CELL, e.g.: C = struct2cell(load(filename)); D = C{1}; Avoid LOADing di...

2 months ago | 0

| accepted

Submitted


Round to Electronic Component Values
Round numeric array values to IEC 60063 resistor/capacitor values (E-Series of preferred numbers).

2 months ago | 6 downloads |

Thumbnail

Answered
Why Does Format of Data Returned from readtable() Depend on Import Options that are Not VariableTypes?
"Is that expected behavior?" Yes. Or at least, not really very surprising. "Why Does Format of Data Returned from readtable()...

2 months ago | 0

| accepted

Answered
Find peaks in a matrix containing zeros
A = [1,3,-1,1,5,-1,0;1,6,3,-2,0,0,0;2,3,9,-2,1,11,-1;4,1,-2,8,5,0,0;2,-2,6,-1,0,0,0;-1,13,-2,0,0,0,0] F = @(a)findpeaks(a,'Thre...

2 months ago | 2

| accepted

Submitted


ColorBrewer: Attractive and Distinctive Colormaps
The complete palette of ColorBrewer 2.0 colormaps. Simple selection by scheme name and map length.

2 months ago | 208 downloads |

Thumbnail

Submitted


CubeHelix Colormap Generator: Beautiful and Versatile!
A versatile implementation of the CubeHelix algorithm to create colormaps (suitable for grayscale conversion)

2 months ago | 11 downloads |

Thumbnail

Answered
Plotting perpendicular lines but they are not perpendicular.
"But as you can see these do not show up as perpendicular." They are perpendicular: check the axes scales! If you want the X a...

2 months ago | 1

| accepted

Answered
Swap shape of cell array full of arrays
C = {[1,2,3,4,5], [1,2,3,4,5]; [1,2,3,4,5], [1,2,3,4,5]} F = @(a)reshape(a,1,1,[]); D = reshape(num2cell(cell2mat(cellfun(F,C,...

2 months ago | 0

| accepted

Answered
How to save current time in file name
You are trying to concatenate STRINGS... and that gives you STRING array with multiple elements, not a character vector nor a sc...

2 months ago | 1

| accepted

Answered
Find the 137th character in a file?
fnm = 'theNameOfYourFile.txt'; txt = fileread(fnm); txt(137)

2 months ago | 2

Answered
add internal parts of a vector
A = [1;1;1;1;1;3;4;8;1;1;1;2;9;1;1;1;1;4;1;1] X = A==1; Y = cumsum([1;diff(X)>0]); Z = accumarray(Y,X)

2 months ago | 2

Submitted


Hyphenate
Word hyphenation using Franklin Mark Liang's algorithm (aka Knuth-Liang algorithm). Used in TeX and LaTeX

2 months ago | 2 downloads |

Thumbnail

Answered
error using system -- "Command argument must be either a nonmissing scalar string or a character row vector. "
"it seems the syntax of the assembled path/file to run is incorrect" True, it is a 1x6 string array. "but I don't know what it...

3 months ago | 2

| accepted

Submitted


MatPlotLib Perceptually Uniform Colormaps
MatPlotLib's default perceptually uniform colormap VIRIDIS and distinctive line ColorOrder TAB10

3 months ago | 126 downloads |

Thumbnail

Answered
interp3 problem: the value of the last sampling coordinate is not match.
"Any insights or suggestions on how to correctly interpolate the profile between p1 and p2 would be greatly appreciated." You a...

3 months ago | 1

Answered
Updating Structure Input for Functions
Do not use nested structures. Definitely do NOT use lots of variables each named after a fruit! Ugh, no. Use a structure array...

3 months ago | 3

| accepted

Submitted


Next Available Filename
Returns the next unused file or folder name. The name is created by incrementing a numbered suffix.

3 months ago | 6 downloads |

Thumbnail

Answered
Function returns different outputs with same inputs
The difference is very simple: Here you return FOUR output arguments from your function call: [e0_, e1_, e2_, e3_] = rotations...

3 months ago | 0

| accepted

Answered
matlab 'unique' is skipping rows with data
The basic problem is that your file is large, and by default READTABLE checks a limited number of rows** before deciding what da...

3 months ago | 1

Answered
Passing functions with fixed input
The MATLAB documentation covers this here: https://www.mathworks.com/help/matlab/math/parameterizing-functions.html See also: ...

3 months ago | 1

| accepted

Answered
Need to speed up a regexprep implementation
"Can anyone (more experienced user!) suggest a faster method of parsing the data records?" I have done a fair bit of playing ar...

3 months ago | 0

Answered
How to fix my attempt to vectorize counts of strings and regexpPatterns in a text file?
SearchTerms = {... 'Term_1', 'Blanket';... 'Term_2', 'blah';... 'Term_3', 'of';... 'Term_4', '(dat|not)\d{1}...

3 months ago | 2

| accepted

Answered
Localize the third vector position using regexp
txt = fileread('test.txt') rgx = '(?<=Field(\S+\s+){3})\S+'; out = regexp(txt,rgx,'once','match')

3 months ago | 0

| accepted

Load more