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
Sort according to specific string contained in file name
S = ["D:\DATA\XY\Project_XY\label_sPR12345_AB67890-0011.nii"; "D:\DATA\XY\Project_XY\label_sPR40922_AB03091-0011.nii"; ...

10 hours ago | 0

Answered
Why am i getting this error 'unrecognized function or variable' for the defined function itself
clc % <---------- !!!!!!!!!!!!!!!!!! DELETE THIS LINE !!!!!!!!!!!!!!!! % <- and this line too function MM = po(conc,p,k) ...

2 days ago | 1

Answered
How could I program a "for loop" in Matlab to calculate the function's minimum value?
X = [1,2,3,4,5]; Y = nan(size(X)); for k = 1:numel(X) b = X(k); G = @(x) x.^2 - b.*x + 1; Y(k) = fminbnd(G,0,10...

2 days ago | 1

Answered
How to use "contains" statement to detect a string without ambiguity?
"Can you help me to solve this issue?" CONTAINS() check if the pattern occurs anywhere inside the string, but this could be a s...

2 days ago | 0

| accepted

Answered
How to round numbers to specific near point?
A = [6.1;6.04;5.98;5.92;5.86;5.8;5.74;5.69;5.63;5.57;5.52;5.46;5.41] N = 0.05; B = round(A/N)*N

3 days ago | 0

| accepted

Answered
What is the orthodox precedure of evaluating/determining the type of a distribution? And How to fit it into a normal distribution with skewness and kurtosis?
The standard appraoch is to use a quantile-quantile plot: https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot which you can do in M...

3 days ago | 0

Answered
Results of math with integer
"I tought using integer math tells that if we woukd result in a non integer result, the non integer part gets truncated:" What ...

3 days ago | 0

| accepted

Answered
Multiple outputs from a for loop
Rather than distracting with anti-pattern numbered variables (like you asked about), instead you should just use basic, normal, ...

4 days ago | 0

| accepted

Answered
Cell2mat with different rows
Download https://www.mathworks.com/matlabcentral/fileexchange/22909-padcat and use it like this: S = load('Cell.mat') A = S.A ...

4 days ago | 1

| accepted

Answered
How to change each column of data in a matrix into a comma expression in an elegant and efficient way?
" I want to directly convert the above matrix A to table type" ARRAY2TABLE() "I can't find a function in matlab that can conve...

4 days ago | 0

| accepted

Answered
Remove single quotes around numeric vector
"Do I have to use another function rather than sprintf?" Get rid of SPRINTF(), converting to character does not help you: Rang...

4 days ago | 0

| accepted

Answered
Processing large matrix faster
Why are you using a loop? Use logical indexing: M = readmatrix('Bathymetry_Data.txt'); X = M(:,3)<(-80); coods = M(X,:);

5 days ago | 0

| accepted

Answered
How to get original values from cumulative sum values?
X = rand(1,9) Y = cumsum(X) Z = [Y(1),diff(Y)] max(X-Z) % alomsot zero Because of the accumulated floating point error getti...

6 days ago | 0

| accepted

Answered
"if sum" (how operator "sum" is possible next to "if"...?)
"Next to "if", there should be logic operator" The IF documentation actually states that it must be an expression. It also stat...

7 days ago | 0

Answered
How can I add an index value to an array value?
M = [0.1,0.1,0.1,0.1;0.2,0.2,0.2,0.2;0.1,0.2,0.3,0.4] M = M + (1:size(M,2))

7 days ago | 2

Answered
All tables being vertically concatenated must have the same number of variables.
It is not clear to me why you want/need a table anyway. Why not simply concatenate that variable directly?: prm = 'DisplayLengt...

8 days ago | 1

| accepted

Answered
How to load intermediate variable into workspace while using ode45 ?
Here is the neat, easy, robust approach which returns exactly the a values at the exact t and x output values: tspan = 1:100; ...

8 days ago | 0

Answered
use eval to define a variable from table and a name stored as cell
EVAL is anti-pattern red-herring. Avoid EVAL. The actual solution is to use the methods shown in the MATLAB documentation: htt...

8 days ago | 1

Answered
How the change the dimensions of multiple arrays with the cell, Matlab?
a = cellfun(@transpose,a,'uni',0)

9 days ago | 0

| accepted

Answered
How can I use a colormap to color each row in a matrix the same color?
You need to transpose the input matrices, so that PLOT() gets 300*25 matrices: colororder(parula(25)) plot(lon.',lat.','Marker...

9 days ago | 1

| accepted

Answered
For loop to make an array from workspace variables
Much much better approach: rather than messing about with ugly EVAL, you should always LOAD() into an output variable (which is ...

11 days ago | 2

Answered
Casting a number into a categorical array
x = categorical({'one','two','three'}) c = categories(x) y = setcats(categorical({'two','two','three'}),c) d = categories(y) ...

11 days ago | 0

| accepted

Answered
How to save tables as .mat files without having to type the filename manually?
The solution is to use function syntax, not command syntax: https://www.mathworks.com/help/matlab/matlab_prog/command-vs-functi...

13 days ago | 0

| accepted

Answered
Get number from a string
B = 'α -0.966 ° OK 4.000 -15.000 ° 23.000 ° Freiwinkel' C = regexp(B,'[-+]?\d+\.?\d*', 'match') V = str2double(C)

15 days ago | 0

| accepted

Answered
How to find the index of the first element which is greater than a particular value in a matrix for all the columns.
N = 5; M = randi(9,5,7) Method one: CUMSUM and FIND: X = M>N; X = X & cumsum(X,1)<2; [R,~] = find(X) Method two: FIND and ...

15 days ago | 1

| accepted

Answered
Strings are converted to cells during readtable
The simple solution is to specify the TEXTTYPE option when importing: data = table("string1", "string2"); writetable(data, "da...

15 days ago | 2

| accepted

Answered
Local functions are not working in MatLab R2022a
"I select it all and press F9." That will not work. You need to run the script by calling it by name from the command line: >...

15 days ago | 1

| accepted

Answered
fprintf within a for / if environment with crazy behaviour
The file is opened with fopen(fileID,'wt')" Perhaps, but in any case, you did not provide the file identifier to FPRINTF. "Wha...

16 days ago | 2

| accepted

Answered
How to extract hour+minute from DateTime vector ?
D = datetime(2016,4,5,[8;11],43,11) isAMRush = isbetween(timeofday(D),duration(7,45,0),duration(8,45,0))

16 days ago | 0

| accepted

Load more