6.053 total contributions since 2014

Suspensa Vix Via Fit

Answered

Distribute colormap matrice for n values where colormap name comes from GUI

"I don't know why it does not work as I intend, is it possible that this way (e.g. cmap = hsv (n); ) does only work for the pred...

Distribute colormap matrice for n values where colormap name comes from GUI

"I don't know why it does not work as I intend, is it possible that this way (e.g. cmap = hsv (n); ) does only work for the pred...

etwa 3 Stunden ago | 0

Answered

loop over a cell and combine cell columns into one column

Where C is your cell array: >> C(:,2) = cellfun(@cell2mat,num2cell(C(:,3:end),2),'uni',0) C = [1x7 double] [1x6 doubl...

loop over a cell and combine cell columns into one column

Where C is your cell array: >> C(:,2) = cellfun(@cell2mat,num2cell(C(:,3:end),2),'uni',0) C = [1x7 double] [1x6 doubl...

etwa 5 Stunden ago | 1

| accepted

Answered

How to change multiple line text into vector (string)

"..or to remove every "enter" from a text to create one line text." That is easy with fileread and regexprep: >> str = filerea...

How to change multiple line text into vector (string)

"..or to remove every "enter" from a text to create one line text." That is easy with fileread and regexprep: >> str = filerea...

etwa 7 Stunden ago | 1

| accepted

Answered

Is there an alternative way to perform the following matrix transformation?

>> N = 3; >> [R,C] = size(A); % specify R to change the number of rows of A used. >> X = hankel(1:N,N:R); >> B = reshape(A(X,...

Is there an alternative way to perform the following matrix transformation?

>> N = 3; >> [R,C] = size(A); % specify R to change the number of rows of A used. >> X = hankel(1:N,N:R); >> B = reshape(A(X,...

etwa 8 Stunden ago | 0

Answered

Unexpected behaviour from ishandle()

On MATLAB versions prior to R2016b zero is the handle to the graphics root (i.e. the parent of all graphics figures): https://w...

Unexpected behaviour from ishandle()

On MATLAB versions prior to R2016b zero is the handle to the graphics root (i.e. the parent of all graphics figures): https://w...

etwa 8 Stunden ago | 0

| accepted

Answered

Find set of values that are unique to the values in another column

>> M = [2,3;2,6;2,8;4,5;5,9;5,39;5,6] M = 2 3 2 6 2 8 4 5 5 9 5 39 5 6 ...

Find set of values that are unique to the values in another column

>> M = [2,3;2,6;2,8;4,5;5,9;5,39;5,6] M = 2 3 2 6 2 8 4 5 5 9 5 39 5 6 ...

etwa 8 Stunden ago | 0

Answered

importing excel file to matlab without losing date format?

Simpler: >> T = readtable('test.xlsx','ReadVariableNames',false); >> T.Properties.VariableNames = {'ymd','HMS','data'}; >> D ...

importing excel file to matlab without losing date format?

Simpler: >> T = readtable('test.xlsx','ReadVariableNames',false); >> T.Properties.VariableNames = {'ymd','HMS','data'}; >> D ...

etwa 21 Stunden ago | 0

Answered

How do I get the date out of a filename using regexp?

In one line without intermediate indices or double vector: >> str = 'xxx_2014_06_03_00_00_01'; >> dtm = datetime(regexp(str,'(...

How do I get the date out of a filename using regexp?

In one line without intermediate indices or double vector: >> str = 'xxx_2014_06_03_00_00_01'; >> dtm = datetime(regexp(str,'(...

etwa 21 Stunden ago | 0

Answered

count string in a cell array

>> S = '945'; >> C = {'1234', '9456', '9457'}; >> nnz(~cellfun(@isempty,strfind(C,S))) ans = 2

count string in a cell array

>> S = '945'; >> C = {'1234', '9456', '9457'}; >> nnz(~cellfun(@isempty,strfind(C,S))) ans = 2

etwa 24 Stunden ago | 0

Answered

How do I call a function handle with an vector - rather than a list of arguments

Easy: first define a cell array: C = {a1Init, wG1, x1,a2, wG2, x2, c, x}; and then use a comma-separated list: fitFunctionHan...

How do I call a function handle with an vector - rather than a list of arguments

Easy: first define a cell array: C = {a1Init, wG1, x1,a2, wG2, x2, c, x}; and then use a comma-separated list: fitFunctionHan...

2 Tage ago | 0

Answered

Load data from mat files to a matrix

N = 50; C = cell(1,N); for k = 1:N F = sprintf('%d.mat',k); S = load(F); C{k} = S.Data(:,3); end M = [C{:}] ...

Load data from mat files to a matrix

N = 50; C = cell(1,N); for k = 1:N F = sprintf('%d.mat',k); S = load(F); C{k} = S.Data(:,3); end M = [C{:}] ...

2 Tage ago | 0

Answered

how to insert a value into the array in a consistent manner.

>> A = ones(3,1); >> A(end+1) = 0; >> A([2:end,1]) = A A = 0 1 1 1

how to insert a value into the array in a consistent manner.

>> A = ones(3,1); >> A(end+1) = 0; >> A([2:end,1]) = A A = 0 1 1 1

2 Tage ago | 0

| accepted

Answered

Code overwrites results in for loop. Cannot figure out how to index.

Either alpha_beta(k,1) = first_data(1); alpha_beta(k,2) = first_data(3); or alpha_beta(k,1:2) = first_data([1,3]); And reme...

Code overwrites results in for loop. Cannot figure out how to index.

Either alpha_beta(k,1) = first_data(1); alpha_beta(k,2) = first_data(3); or alpha_beta(k,1:2) = first_data([1,3]); And reme...

2 Tage ago | 0

Answered

Index exceeds the number of array elements (35).

You have repeatedly used syntax with an = sign, which assigns those values to some variables, e.g: xlabel=('estimated time--->'...

Index exceeds the number of array elements (35).

You have repeatedly used syntax with an = sign, which assigns those values to some variables, e.g: xlabel=('estimated time--->'...

3 Tage ago | 0

Answered

Understanding Figure Windows & Changing Their Apperances

"Why cannot i amend the Number property?" Because the 'Number' property is read only: https://www.mathworks.com/help/matlab/re...

Understanding Figure Windows & Changing Their Apperances

"Why cannot i amend the Number property?" Because the 'Number' property is read only: https://www.mathworks.com/help/matlab/re...

5 Tage ago | 0

| accepted

Answered

How do I change the values of rows in specific columns based on another table which serves as a lookup?

>> A = [2001,2001;2001,2003;2001,2005;2001,2006] A = 2001 2001 2001 2003 2001 2005 2001 2006 >> B = [1...

How do I change the values of rows in specific columns based on another table which serves as a lookup?

>> A = [2001,2001;2001,2003;2001,2005;2001,2006] A = 2001 2001 2001 2003 2001 2005 2001 2006 >> B = [1...

6 Tage ago | 0

| accepted

Answered

How do I locate all integer values within a matrix (of string and integer values in the same cell), then replace all those integer values with a 1 or 0 thus forming a new matrix with the replaced integers?

Method one: multiple regular expressions in one regexprep call: >> c = {'( x(2) | x(1) )', 'x(3)', '( x(4) | x(6) | x(5) )', '(...

How do I locate all integer values within a matrix (of string and integer values in the same cell), then replace all those integer values with a 1 or 0 thus forming a new matrix with the replaced integers?

Method one: multiple regular expressions in one regexprep call: >> c = {'( x(2) | x(1) )', 'x(3)', '( x(4) | x(6) | x(5) )', '(...

9 Tage ago | 1

Answered

Averaging 30 arrays into one using function

Do not create lots of separate variables or arrays, just use the split-apply process: https://www.mathworks.com/help/matlab/mat...

Averaging 30 arrays into one using function

Do not create lots of separate variables or arrays, just use the split-apply process: https://www.mathworks.com/help/matlab/mat...

9 Tage ago | 0

Answered

Dont know how to name this...

MATLAB only accepts decimal point , and does NOT accept a decimal comma. When you write a comma you are writing two separate va...

Dont know how to name this...

MATLAB only accepts decimal point , and does NOT accept a decimal comma. When you write a comma you are writing two separate va...

9 Tage ago | 1

| accepted

Answered

Please help me to understand Error "The expression to the left of the equals sign is not a valid target for an assignment.

The problem is your invented syntax using { and }, which looks like you are trying to write code using a different programming l...

Please help me to understand Error "The expression to the left of the equals sign is not a valid target for an assignment.

The problem is your invented syntax using { and }, which looks like you are trying to write code using a different programming l...

9 Tage ago | 2

| accepted

Answered

How to read specific parts of file and then write it to a text file?

This imports all of the "TEC MAP" data from the file you uploaded: str = fileread('codg1520.14i'); % Functions to convert text...

How to read specific parts of file and then write it to a text file?

This imports all of the "TEC MAP" data from the file you uploaded: str = fileread('codg1520.14i'); % Functions to convert text...

9 Tage ago | 0

| accepted

Submitted

MatPlotLib Perceptually Uniform Colormaps

MatPlotLib's default perceptually uniform colormap VIRIDIS and distinctive ColorOrder TAB10/VEGA10

10 Tage ago | 70 downloads |

Answered

Minimum value of loop

>> N = 3; >> a = Inf; >> for k = 1:N, a = min(a,k+2); end >> a a = 3

Minimum value of loop

>> N = 3; >> a = Inf; >> for k = 1:N, a = min(a,k+2); end >> a a = 3

10 Tage ago | 0

| accepted

Answered

How to concatenate all these cells vertically?

>> load('matlab.mat') >> R = S.result; >> T = vertcat(R{:}); >> whos T Name Size Bytes Class Attr...

How to concatenate all these cells vertically?

>> load('matlab.mat') >> R = S.result; >> T = vertcat(R{:}); >> whos T Name Size Bytes Class Attr...

10 Tage ago | 1

| accepted

Answered

Creating a tridiagonal matrix

"My teacher has said that the best way to go about it is using loops" Why on earth would they say that? Either diag : >> N = 1...

Creating a tridiagonal matrix

"My teacher has said that the best way to go about it is using loops" Why on earth would they say that? Either diag : >> N = 1...

11 Tage ago | 1

Answered

split a string by a set of pre-defined number of characters rather than any delimiter

You could do that using regular expressions: >> S1 = ' 961.666 - Psat 1.0000 45.0971 3.6734';...

split a string by a set of pre-defined number of characters rather than any delimiter

You could do that using regular expressions: >> S1 = ' 961.666 - Psat 1.0000 45.0971 3.6734';...

14 Tage ago | 0

| accepted

Answered

removing non prime number function

str = fileread('temp.txt'); vec = str2double(regexp(str,'\d+','match')) [fid,msg] = fopen('output.txt','wt'); assert(fid>=3,m...

removing non prime number function

str = fileread('temp.txt'); vec = str2double(regexp(str,'\d+','match')) [fid,msg] = fopen('output.txt','wt'); assert(fid>=3,m...

14 Tage ago | 0

Answered

Repeat the value of a variable to match the length of another variable

>> X = 'TESTING'; >> Y = 'WORLD'; >> Z = Y(1+mod(0:numel(X)-1,numel(Y))) Z = WORLDWO

Repeat the value of a variable to match the length of another variable

>> X = 'TESTING'; >> Y = 'WORLD'; >> Z = Y(1+mod(0:numel(X)-1,numel(Y))) Z = WORLDWO

15 Tage ago | 0

Answered

Substract Matrix coloum-wise from Matrix without using a loop

permute lets you do this on one line: D = min(sqrt(sum(bsxfun(@minus,permute(A,[1,3,2]),permute(B,[3,1,2])).^2,3)),[],1); And ...

Substract Matrix coloum-wise from Matrix without using a loop

permute lets you do this on one line: D = min(sqrt(sum(bsxfun(@minus,permute(A,[1,3,2]),permute(B,[3,1,2])).^2,3)),[],1); And ...

15 Tage ago | 0

| accepted