# Stephen

Suspensa Vix Via Fit

**Statistics**

RANK**5**

of 242 629

REPUTATION**28 024**

CONTRIBUTIONS

**3** Questions

**7 448** Answers

ANSWER ACCEPTANCE **
100.0%
**

VOTES RECEIVED**4 558**

RANK**144** of 17 000

REPUTATION**7 870**

AVERAGE RATING**4.90**

CONTRIBUTIONS**22** Files

DOWNLOADS **729**

ALL TIME DOWNLOADS**62784**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Compare 2 strings without using ismember or strcmp

Presuming that your examples with invalid syntax are actually supposed to be string arrays: a = ["qwert34776";"dnfien/8863";"fe...

ungefär 18 timmar ago | 0

| accepted

Reducing number of elements.

V = rand(100,1) Z = mean(reshape(V,10,10),1).'

ungefär 19 timmar ago | 0

How can I add n columns to a matrix?

A simpler, more versatile, and much more efficient approach is to use ZEROS: R = size(X,1); C = number_of_new_columns; X = [...

ungefär 21 timmar ago | 1

| accepted

I want to increase my cell's length by 8 times, by making each and every element copying by 8 times.

C = {'cat','dog'}; D = repelem(C,8)

ungefär 23 timmar ago | 0

| accepted

How to use interp1 command?

Numbering your variables like that is a red-herring that makes this task more complex. MATLAB is designed to work efficiently w...

en dag ago | 0

| accepted

I am attempting to change the value 'K' to a value of 10 so I can add it to other numbers.

Putting meta-data (e.g. the suits, card types) into variable names makes this task much harder. Meta-data is data and should be...

en dag ago | 0

Dimensions of arrays being concatenated are not consistent.

The problem is the line-break without any ellipses. But your code can be simplified anyway, removing that problem: x = [ConcVal...

en dag ago | 0

How to subtract coloumn vectors of a cell array

inp = load('mycell.mat').mycell; % input data fun = @(m) 1+diff(m,1,2); % anonymous function out = cellfun(fun,inp, 'uni',0) %...

en dag ago | 0

How to publish html in matlabcentral?

This can be done when you upload a submission to File Exchange (aka. FEX). You will need to: publish your M-file to HTML using ...

2 dagar ago | 0

| accepted

How to accumulate values from time 1 to the last time

P = 'absolute or relative path to where the files are saved'; S = dir(fullfile(P, '*.txt')); % Select the file extension to su...

2 dagar ago | 0

Split a cell array of character vectors at multiple-number delimiter

Rather than telling us what you currently get, it is probably more useful if you tell us what you want. I made some guesses abo...

4 dagar ago | 1

| accepted

Reading mixed format data containing both text and numbers from a '.txt' file in matlab

fpt = '.'; % absolute or relative path to where the file is saved. fnm = fullfile(fpt,'text.txt'); % Count the header lines: ...

4 dagar ago | 1

Determining Order of flattening an array using colons

"If we use A(:,:) we expect an array with dimensions (X*Y, Z), with the i,j element pointing at (i mod X, i div Y, j) element o...

4 dagar ago | 1

| accepted

Saving file at different directory

You need to use FULLFILE to include the path in the filename, e.g.: [F,P] = uiputfile('FileNAME.txt'); fnm = fullfile(P,F); % ...

6 dagar ago | 1

| accepted

MATLAB plot is blank?

You are using matrix division where you should be using array division: https://www.mathworks.com/help/matlab/matlab_prog/array...

6 dagar ago | 0

| accepted

Get row number with certain data in it

"I tried the "find"-function but it didnt bring me to a useful result." It works for me: % Fake data: M = randi(9,7,2); M(5,...

6 dagar ago | 0

Add '_max' to odd variable names and '_min' to even ones.

T = array2table(rand(5,8),'VariableNames',{'Var1','t','Var3','ang_azi','Var5','vel_azi','Var7','acc_azi'}) T.Properties.Variabl...

6 dagar ago | 0

| accepted

How to I add zeroes onto a matrix?

Where V is your vector: V(end+1:52500) = 0

6 dagar ago | 1

I just need to get the numbers from this vector. The result must be a double. I need fast and clean code, as this operation is performed over and over again in my code.

Fastest: C = {'G07','G23','G04','G08','G20','G13','G30'}; V = sscanf(sprintf('%s',C{:}),'G%f')

6 dagar ago | 0

How do you capitalize the first and the third letter of each word in a sentence?

T = 'my pet is hungry'; U = regexprep(T,'(?<=\<(\w{2})?)(\w)','${upper($1)}') Of course because this is clearly homework you w...

6 dagar ago | 0

I need a function to identify if a number is part of a vector or matrix.

Where M is your matrix and N is your scalar number: any(N==M(:))

7 dagar ago | 1

| accepted

change the first digits when ends with 5959

Rather than messing around with strings you should probably just work with duration objects or numeric arrays. S = ["000000";"0...

7 dagar ago | 0

| accepted

How to merge two tables, keeping independent variable (x) the same but summing the dependent variable (y)

Simpler: T1 = readtable('Confoss_landings.xls', 'VariableNamingRule','preserve') T2 = readtable('Mainefoss_landings.xls', 'Var...

7 dagar ago | 0

Interpolate/Resample to a specific decimal point

Assuming no adjacent duplicate values: S = 1; V = [1,3,4,7,6,3,6]; X = cumsum([1,abs(diff(V))]); Z = interp1(X,V,1:S:X(end))...

7 dagar ago | 0

| accepted

How to combine 2 tables with different variables into 1 table?

The actual MATLAB solution just takes one simple line of code: SysTime = [1;2;3;4;5]; EDF = [10;20;30;40;50]; T1 = table(SysT...

7 dagar ago | 2

How to properly format a data table with fprintf?

A = [1,2,3,4,5]; fprintf('Numbers%s\n',sprintf(' %1.2f',A))

7 dagar ago | 0

Why the results of the matrix X' dont show?

Use https://www.mathworks.com/help/matlab/ref/mldivide.html A = [0,2,-1,0;0,0,1,-1;1,-1,0,0;-1,0,0,1]; B = [100;-500;300;100];...

7 dagar ago | 1

| accepted

Create Multiple Arrays While Looping Through One Single Array

By far the simplest and most efficient solution is to use one matrix: V = 1:81 M = reshape(V,9,9).' You can trivially access ...

8 dagar ago | 1

| accepted

how to add elements to an array in a for loop

The MATLAB approach is to use logical indexing, not a loop: V = [2,4,5,6,3]; N = sum(V(V>=5))

9 dagar ago | 0

I am unable to display my answers on command window

https://www.mathworks.com/help/matlab/ref/display.html a = [3 6 1 9; 6 5 3 7; 7 3 2 6]; display(a)

9 dagar ago | 0