Community Profile

photo

Stephen23


Active since 2014

Suspensa Vix Via Fit

Statistics

All
  • Most Accepted 2021
  • Grand Master
  • Personal Best Downloads Level 4
  • Editor's Pick
  • First Review
  • 5-Star Galaxy Level 5
  • GitHub Submissions Level 3
  • First Submission
  • 36 Month Streak
  • Thankful Level 5
  • Revival Level 2
  • Knowledgeable Level 5

View badges

Content Feed

View by

Answered
Extract value until regexp case match
Does the data you want to match always occur at the start of the string? A = "9/12/2022 7:38:51 PM 216 Indicator"; B = regexp(...

1 día ago | 0

Answered
Sine Function I'm trying to Plot won't show up
"Not sure what I'm doing wrong here." You need to use element-wise division, not matrix division: phi = 0:0.1:6*pi; I2 = sin(...

2 días ago | 1

| accepted

Answered
replacing text in a string using indexing
For overlapping matches use STRREP. For non-overlapping matches use REGEXPREP: regexprep('qqqqqq','qqq','qwe') regexprep('qqq...

4 días ago | 0

Answered
How can I discretize data by their sign?
A = [-2,-1,5,-10,7,3,-9,-12,11]; B = sign(A); C = cumsum(logical([1,diff(B)]))

5 días ago | 0

| accepted

Answered
Skipping certain lines using fscanf
C = {}; [fid,msg] = fopen('polydata.txt','rt'); assert(fid>=3,'%s',msg) while ~feof(fid) C{end+1} = sscanf(fgetl(fid),'%...

5 días ago | 0

Answered
Creating Own Time Variable from Datetime Data
"I hope someone can help me convert my datetime time variable into working with a new time variable, thanks. " Your question do...

5 días ago | 0

Answered
How inv() works ?
The INV documentation states "inv performs an LU decomposition of the input matrix (or an LDL decomposition if the input matrix ...

6 días ago | 1

Answered
Convert matrix into CSV, with each matrix element as a separate line including indices of matrix element
M = [0.5,0.1,0.6;0.9,0.8,0.3] N = M.'; S = size(N); [X,Y] = ndgrid(1:S(1),1:S(2)); writematrix([X(:),Y(:),N(:)],'test.txt') ...

7 días ago | 1

Answered
Why does the code have Check for incorrect argument data type or missing argument in call to function 'zero'?
Change the function from ZERO to ZEROS. ZEROS creates an array of the value 0: https://www.mathworks.com/help/matlab/ref/zeros....

9 días ago | 1

Answered
how filter "*.*" when using uigetfile function.
If there are no descriptors, the "All files" is automatically appened onto the end of the filter. The solution is to add descrip...

9 días ago | 0

| accepted

Answered
How to subtract ?
The simple MATLAB approach: S = load("allmat.mat"); M = S.allmat M(:,6) = M(1,6)-cumsum(M(:,5))

9 días ago | 0

| accepted

Answered
Creating a table by extracting rows from a table based off their values in relation to another table of a different size.
a = [11;33;55;77;99;23;45;67;89;87;65;43;10;1;3;5]; b = [22;44;66;88;12;34;56;78;98;76;54;32;21;2;4;6]; c = [2;2;2;2;4;4;4;4;6...

10 días ago | 0

Answered
I got wrong data when i use datetime convertfrom
S = load('time.mat'); D = S.time T = datetime(1800,1,1) + hours(D)

10 días ago | 0

| accepted

Answered
How to use the command window in order to make a script faster and interactive?
I had to write a script to carefully remove all of those numbers from the variable names and recreate the original MAT files acc...

10 días ago | 0

| accepted

Answered
Using diff(x) function to create a new table by subtracting values from the previous row
M = readmatrix('Data241.xlsx') [~,idr] = sort(isnan(M),1); [~,idc] = ndgrid(1:size(M,1),1:size(M,2)); A = -diff(M(sub2ind(siz...

10 días ago | 1

| accepted

Answered
Error in datetime array format for writing new matrix
Ah, fractional years. Here is one way to convert a fractional year (yes, even leap years) to datetime: format long G M = readm...

11 días ago | 0

| accepted

Answered
Matlab Vlookup/Indexing equivalent
DT = [datetime(2027,1,1,(0:4).',0,0);datetime(2028,1,1,0,0,0)] Y = year(DT); M = [2027,1.2,200,350;2028,3.7,200,350;2029,7.2,2...

11 días ago | 0

| accepted

Answered
How to interchange position of a matrix?
A = [3,1,2]; B = [2,3,1]; X = [2,1,3]; for k = 1:numel(X) X([A(k),B(k)]) = X([B(k),A(k)]); end X

11 días ago | 1

| accepted

Answered
How can I split string based on a sting array?
S = "alpha{ beta} new {} new2}"; T = ["alpha","beta", "{","}"]; [X,Y] = strsplit(S,T, 'CollapseDelimiters',false); X = strtri...

11 días ago | 0

| accepted

Answered
Variable name from a cell content
You could use a structure to store all of the tables: F = "Input.xlsx"; S = sheetnames(F); D = struct(); for k = 1:numel(S) ...

11 días ago | 0

Answered
Access variables with naming in workspace
This appears to be a follow up from your question from seven hours ago: https://www.mathworks.com/matlabcentral/answers/1804720...

11 días ago | 2

Answered
Using load for different files with varying names
Here is a robust approach, by not LOADing directly into the workspace, which also also resolves your follow-up question. The cod...

11 días ago | 0

Answered
Condense code in Split string operation
s = "xxx_yyy_zzz.xlsx"; regexp(s,'[^_.]+(?=\.)','match','once')

12 días ago | 1

| accepted

Answered
My matlab code with interp3 is not providing me correct answer. Please help.
format compact T = readtable('interpcheck.csv') A = accumarray([T.x,T.y,T.z],T.result) X = unique(T.x); Y = unique(T.y); Z ...

12 días ago | 0

| accepted

Answered
Where is the Documentation for Indexing on the Left Hand Side of an Assignment?
Here: https://blogs.mathworks.com/loren/2020/01/31/repeated-indexing-in-matlab/ https://blogs.mathworks.com/loren/2007/07/26/as...

13 días ago | 1

| accepted

Answered
extract the last value from each cell in array?
The simple MATLAB approach: M = readmatrix('transRewards_40_0.1_2.csv', 'LineEnding',']', 'TrimNonNumeric',true) plot(M(:,20))...

15 días ago | 0

Answered
Questions about the rgb2gray function
"does anyone know why?" The values shown in the documentation are shown only to 3 decimal places. The actual values used for t...

15 días ago | 0

| accepted

Answered
Replacing values of a vector with values in another vector of a different size
A = [0,0,0,1,1,1,0,0,1,1,0,0,0]; B = [1,2,3,inf,4]; C = double(A); C(A==1) = B; C(isinf(C)) = 0

16 días ago | 0

| accepted

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,...

16 días ago | 21 downloads |

Thumbnail

Answered
How do I compare two shuffled vectors, and get the indexes of one as it appears in the other?
A = ["cond1","cond2","cond3","cond4"]; b = ["cond4","cond2","cond1","cond3"]; [~,X] = ismember(A,b)

16 días ago | 1

| accepted

Load more