Community Profile

photo

Stephen23


Active since 2014

Suspensa Vix Via Fit

Statistics

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

View badges

Content Feed

View by

Answered
Help with Pre-allocating function values
The MATLAB approach: lf = [697,770,852,941]; hf = [1209,1336,1477]; [X,Y] = meshgrid(lf,hf); f = [X(:),Y(:)] Or T = comb...

1 day ago | 1

| accepted

Answered
I have a problem in my code. Who can help me to fix it?.. I can't find my mistake. Please help me.
Rather than forcing pseudo-indices into variable names and then attempting to use STR2FUNC.... simply use a cell array: lambda ...

3 days ago | 1

| accepted

Answered
How to avoid log10 from calculating for log values or if its calculated for complex log how do i avoid it?
"how do i avoid this function calculating the log value of negative numbers." Don't call the function with negative values. de...

3 days ago | 0

Answered
using cell to add row
xxx = {'Lavorato assieme n. giorni',' ',1;'Giorno Positivi e negativi ',' ',2} xxx(3,:) = {'Lavorato xxx',' ',3}

3 days ago | 0

| accepted

Answered
Illegal use of reserved keyword "elseif" keep showing up?
If you align your code consistently then the problem is very clear: if inp == '0' .. end % <- delete this elseif inp =='...

4 days ago | 1

| accepted

Answered
Using repelem to vertially concatonate non-numeric variable
".. repmat function might be a better choice, since it allows the dimensions to be specified." As does REPELEM: repelem('1001_...

4 days ago | 1

Answered
Is there a functional form in Matlab to get the same result as A{:}?
The closest you can get is to convert the output into a structure and index into that (since R2019b) to generate a comma-separat...

4 days ago | 0

Answered
Error using bar: inputs must be 2-D
The command zeros(1,2,3,4,5,6,7) creates a 7D array with size 1x2x3x4x5x6x7. What you need is a 2D matrix: zeros(1,7) Tip: th...

4 days ago | 0

| accepted

Answered
Matlab - inputs must be scalar when using linspace
replace this line for i = find(~compareHeight) with for i = reshape(find(~compareHeight),1,[]) The cause is an awful, useles...

5 days ago | 0

Answered
rlocfind returns error: Execution of script poly as a function is not supported
"Execution of script poly as a function is not supported" You have created a script named POLY. Rename that script. To find th...

5 days ago | 1

| accepted

Answered
Inverse Matrix for 6x6 matrix with variables
syms x y z A = [x,y,y,0,0,0; y,x,y,0,0,0; y,y,x,0,0,0; 0,0,0,z,0,0; 0,0,0,0,z,0; 0,0,0,0,0,z]; b = inv(A)

6 days ago | 0

Answered
Trouble with date conversion
Rather than fiddling around with text or numerics, just import the 2nd column as DATETIME right from the start: fnm = 'uurgeg_3...

6 days ago | 2

Answered
How to know exactly what row (or index number?) in a table based on user input?
Fake data: dt = datetime(2023,11,1:7).'; V = rand(7,1); T = table(dt,V) Date that you want: want = datetime(2023,11,4) Obt...

6 days ago | 0

Answered
Is there a way to dynamically use either brackets or curved bracket indexing depending on a variable?
"I understand it can be done with if statements but this will take up massive amounts of space in the code so I try to avoid it....

6 days ago | 2

| accepted

Answered
Replacing values in a Matrix
A = [25,40,40,40,25,25,25,25,25,25; 25,40,40,40,40,25,25,25,25,25; 25,25,40,40,40,40,25,25,25,25; 25,25,40,40,40,40,40,25,25,25;...

8 days ago | 1

Answered
how convert string in struct with 0/1
S = struct('FS',{'Si','No','Si','Rank','No'}) Z = nan(size(S)); [X,Y] = ismember({S.FS},{'No','Si'}); Z(X) = Y(X)-1

10 days ago | 0

| accepted

Answered
How to assign a mean of a variable to every year ?
The simple and efficient MATLAB approach: DateYear = [2016;2016;2010;2008;2016;2016;2009;2008;2007;2010]; SeverityCode = [3;3;...

10 days ago | 1

Answered
Convert char to table
If you already have a character vector and the goal is to print it to file, then avoid the indirection of converting to numeric ...

11 days ago | 1

Answered
Readtable Returns "NaN" to the string type value if one column contains both number type and string type values
Use READCELL: C = readcell('test.csv') Everything that is text is text, everything that is numeric is numeric. Easy.

14 days ago | 0

| accepted

Answered
How can I improve my regular expressions?
Get rid of the look-behind expressions. They don't restrict which block of data is being read anyway. Also note that '.' matche...

14 days ago | 0

| accepted

Answered
Conditional Question Matlab Disagreement
"...but my teacher says it’s one and I’m super confused. Any explanation would be appreciated, thanks!" This code (6+3)>8>2 i...

20 days ago | 1

Answered
Extracting value from array
"For one value it does work, but not for all of them." It does work, your screenshot clearly informs us that you are getting on...

20 days ago | 0

| accepted

Answered
how to load all mat files in the filenumber wise sequentially ?
Follow this link and click the big DOWNLOAD button in the top right corner: https://www.mathworks.com/matlabcentral/fileexchang...

21 days ago | 1

| accepted

Answered
surf for n-dimensional cartesian matrix
Perhaps one of these: https://www.mathworks.com/help/images/ref/sliceviewer.html https://www.mathworks.com/help/images/ref/vol...

21 days ago | 0

Answered
Creating a new matrix from unique combinations in two other matrices
[A,B] = meshgrid(repelem(1:3,3),1:3) M = [reshape(A.',[],1),reshape(B.',[],1)]; [~,~,X] = unique(M,'rows','stable'); C = resh...

21 days ago | 0

| accepted

Answered
Reshape data the first row becomes the different columns
ID = [1;1;1;2;2;2]; Date = datetime(2015,1,[1;2;3;1;2;3]); vals = [0;0.5;-0.3;0;0.2;0.5]; T = table(ID,Date,vals) U = unstac...

21 days ago | 4

| accepted

Answered
Extract indices of vector?
X = find(B)

21 days ago | 0

| accepted

Answered
Error using readtable '.1(0a)' is not a recognized file extension. Unable to detect file type.
I strongly recommend avoiding forcing meta-data (e.g. filenames) into structure fields like that. To make your approach work wou...

21 days ago | 0

Answered
I have error when i convert modified julian data to datetime
"how can i convert time_mjd to exact same date with time0?" The short answer is that you can't, simply because the limited prec...

24 days ago | 1

Answered
how can a symbolic derivative be vectorized automatically?
Use MATLABFUNCTION: syms a b c f = a*sin(b)*exp(c) df = diff(f,b) mf = matlabFunction(df) a=rand(10,1); b=rand(10,1); c=r...

24 days ago | 2

| accepted

Load more