Community Profile

photo

Stephen23


Active since 2014

Suspensa Vix Via Fit

Professional Interests:

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
assign cell arrays to struct
You could use CELL2STRUCT : fnm = {'hello','world'}; val = {[1,NaN],[1,4,9]}; S2 = cell2struct(val,fnm,2) or a comma-separat...

ungefär 15 timmar ago | 0

Answered
how to find indices of duplicates in array and save results on a structure
A = [1;5;2;5;3;3;4;1;2;1]; [U,~,X] = unique(A); V = 1:numel(A); C = accumarray(X,V(:),[],@(v){v}); S = struct('value',num2ce...

ungefär 17 timmar ago | 0

| accepted

Answered
Logical indexing cell array
That is an inefficient way to store and process that data. Using one numeric array would be simpler and much more efficient: M...

ungefär 23 timmar ago | 1

Answered
Can you download individual images from the image labeling app onto an external hard drive?
"but I can't figure out a way to set the hard drive as the folder I want to save my images in" Don't. Do not set/change to oth...

ungefär 24 timmar ago | 0

Answered
Help iteration for loop and tables vertcat
Using one cell array will be much simpler (and more efficient) than your approach of numbering the variable names: w = 1:10; % ...

en dag ago | 1

| accepted

Answered
Splitting table text column with multiple delimiters based on parantheses.
S = ["Player collected a YELLOW coin at (-5.5, 10.9, 90.1)";"Access to new world";"New world entered";"Player collected a GREEN ...

en dag ago | 0

Answered
How to store multiple output tables in a cell array
With MATLAB it is easier and more versatile to loop over indices, rather than looping over data. This makes it easy to prealloca...

2 dagar ago | 0

| accepted

Answered
How can I separate the elements of a vector ?
for jj = i(diff(i)~=0) or for jj = unique(i,'stable')

2 dagar ago | 0

| accepted

Answered
multiplication by taking into account the values when creating a matrix
A = [2,1,4,3;10,15,20,10;20,10,15,20] B = [1,3,4;4,5,6;2,1,4;3,5,1] C = [50;100;25;10] lkp = [10,15,20]; idx = A(1,:); [~,i...

2 dagar ago | 1

| accepted

Answered
How to read floating point number 5.3246-5 as 5.3246E-5 in text file
str = '9.4345-51.8998772.518305'; tmp = cellstr(reshape(str,8,[]).'); tmp = regexprep(tmp,'(?<=\d)([-+]\d+)$','E$1') vec = st...

3 dagar ago | 0

Answered
How to make a two-dimensional mask act on a three-dimensional array?
"I wondered if there was any neat trick to do it by array multipication..." A = 9* ones (6,4,3); % create a 3 dimensional array...

3 dagar ago | 0

Answered
How to create a matrix with special block diagonal structure
N = 8; C = arrayfun(@ones,1:N,'uni',0); B = tril(blkdiag(C{:})); spy(B)

4 dagar ago | 0

Answered
Remove text from CSV data
str = readlines('20220427T131641-2d.csv'); idx = startsWith(str,digitsPattern); writelines(str(idx),'new.csv') Checking: typ...

4 dagar ago | 0

| accepted

Answered
How can I get my function that calculates distance between data and user input with sort data and closest data set from file
V = [2,5,7]; M = readmatrix('somedata.xlsx') D = vecnorm(M-V,2,2) [X,Y] = mink(D,2) Z = M(Y,:)

4 dagar ago | 0

| accepted

Answered
In a 6x6 square matrix A, how to select elements in i-th row with A(i,j) ruled out
A = [0,0,-1,1;1,1,0,0;0,0,1,0;1,-1,0,1] B = +diag(diag(A) & ~any(A-eye(size(A)),2))

4 dagar ago | 0

Answered
convert lower case to upper and upper to lower
str = '123 Hello World!'; str = regexprep(str,'[A-Za-z]+','${char(mod($&-97,64)+65)}')

6 dagar ago | 0

Answered
How can we convert a number into a string value with the exact number of digits present in the number?
sprintf('%.15g',0.0199155) sprintf('%.15g',0.01991556789) sprintf('%.15g',23456.7891234)

9 dagar ago | 0

| accepted

Answered
find first& end of array
S = [0,1,5,2,0,0,0,9,3,50,53,0,0,5,7,4] X = diff([0;S(:)]==0)<0 | diff([S(:);0]==0)>0; V = S(X)

9 dagar ago | 0

| accepted

Answered
separating numbers in cells
Assuming that you have a cell array of character vectors: C = {'1-8','7-1','8-4';'4-6','8-5','7-3'} D = split(C,'-'); A = str...

10 dagar ago | 0

| accepted

Answered
How to find the index of the first absolute minimum entry of a matrix
A = [5,7,0.5,5;2,0.5,4,1;0.5,6,7,9]; [V,X] = min(A.',[],'all'); [C,R] = ind2sub(size(A),X)

10 dagar ago | 0

Answered
About importdata(filename) function in Matlab
"I have created two .dat files using a same perl script, but on different machines." And they have created different files. "C...

10 dagar ago | 0

Answered
TUTORIAL: Comma-Separated Lists and How to Use Them
A common misunderstanding of comma-separated lists involves nested structures. The expectation is that dot-indexing at arbitrary...

11 dagar ago | 0

Answered
Evaluating a function with Matlab
"Can anyone help me figure out why I am getting an imaginary number in the following code:" Because you are taking the power of...

11 dagar ago | 0

| accepted

Answered
storing excel data in matrix using for loop
n = 4; A = zeros(n,20); F = 'filename.xyz'; for y = 1:n S = sprintf('sheetname_%d',y); A(y,:) = readmatrix(F, 'Shee...

13 dagar ago | 0

Answered
Create new matrices based on the number of unique values
Those three matrices are a red-herring. M = [4,7,2;2,4,7;2,2,4] [U,~,X] = unique(M(:)); S = accumarray(X,M(:)) [~,Y] = max(S...

15 dagar ago | 1

| accepted

Answered
sum a column in a matrix
F = @(t) sum(t{:,7}); V = cellfun(F,Tables)

15 dagar ago | 1

| accepted

Answered
How can I avoid using addpath to read files outside Matlab's search folder?
" Is it correct that before files can be read by Matlab, the folder where files are located have to be added to Matlab's search ...

16 dagar ago | 0

| accepted

Answered
How to use outerjoin for multiple files
fnm = compose("file%d.csv",1:5); tbl = readtable(fnm(1)); tbl.Properties.VariableNames = {'Key1','Var1'}; for k = 2:numel(fnm...

16 dagar ago | 1

| accepted

Answered
Counting outcomes of names
str = ["Sam";"Joe";"TPG, Sam, Joe";"TPG, Joe"] spl = regexp(str,',','split'); [uni,~,idx] = unique(strtrim([spl{:}])); cnt = ...

17 dagar ago | 1

Answered
Make function in function
syms x g = 5*x f = g+3

17 dagar ago | 0

Load more