Suspensa Vix Via Fit

Answered

How can I use the split function with multiple delimiters?

>> str = 'software_logical/forIteratorSubsystem/Out1'; >> [one,two] = fileparts(str) one = software_logical/forIteratorSubsyst...

How can I use the split function with multiple delimiters?

>> str = 'software_logical/forIteratorSubsystem/Out1'; >> [one,two] = fileparts(str) one = software_logical/forIteratorSubsyst...

alrededor de 5 horas ago | 0

Answered

Simplify a string with MATLAB script

>> Eq = 'A_1+((A_2+A_3)&(A_4+A_5))+A_6'; >> Fq = regexprep(Eq, '^([A-Z]+_)(.*)', '$1\(${strrep($2,$1,'''')}\)') Fq = A_(1+((2...

Simplify a string with MATLAB script

>> Eq = 'A_1+((A_2+A_3)&(A_4+A_5))+A_6'; >> Fq = regexprep(Eq, '^([A-Z]+_)(.*)', '$1\(${strrep($2,$1,'''')}\)') Fq = A_(1+((2...

alrededor de 8 horas ago | 0

Answered

How to Set Specific Arg in Function

"I've tried seraching for how to change/edit/give a specific argument but I can't find it. I've tried the following options but ...

How to Set Specific Arg in Function

"I've tried seraching for how to change/edit/give a specific argument but I can't find it. I've tried the following options but ...

alrededor de 11 horas ago | 1

| accepted

Answered

How can i extract parameters from a vector at specific values

Use ismember: >> A = 1:10 A = 1 2 3 4 5 6 7 8 9 10 >> B = 11:20 B = 11 12 13 14 1...

How can i extract parameters from a vector at specific values

Use ismember: >> A = 1:10 A = 1 2 3 4 5 6 7 8 9 10 >> B = 11:20 B = 11 12 13 14 1...

alrededor de 13 horas ago | 0

| accepted

Answered

Extracting data from strings with varying delimiters and column widths

You can insert delimiters between those numbers, e.g. using regexprep: str = regexprep(str,' *(\d+?) *(\d{1,4}\.\d+)','$1,$2,')...

Extracting data from strings with varying delimiters and column widths

You can insert delimiters between those numbers, e.g. using regexprep: str = regexprep(str,' *(\d+?) *(\d{1,4}\.\d+)','$1,$2,')...

alrededor de 13 horas ago | 1

| accepted

Answered

How to delete the columns in a structure array

Where S is your structure: X = arrayfun(@(s)any(structfun(@numel,s)<10),S); S(X) = [] Tested: >> S = struct('A',{rand(1,99),...

How to delete the columns in a structure array

Where S is your structure: X = arrayfun(@(s)any(structfun(@numel,s)<10),S); S(X) = [] Tested: >> S = struct('A',{rand(1,99),...

alrededor de 14 horas ago | 0

Answered

Simplest way to save a vector to a variable with commas and braces

You can create a character vector: >> strrep(mat2str(a),' ',',') ans = [1,2,3,4,5] which you can save however you want. But t...

Simplest way to save a vector to a variable with commas and braces

You can create a character vector: >> strrep(mat2str(a),' ',',') ans = [1,2,3,4,5] which you can save however you want. But t...

alrededor de 14 horas ago | 0

Answered

Sort certain matrix cells in a vector

Linear indexing: >> G = Start_Matrix([15;16;18;12;13;14]) G = 78.808 83.353 112.37 188.5 ...

Sort certain matrix cells in a vector

Linear indexing: >> G = Start_Matrix([15;16;18;12;13;14]) G = 78.808 83.353 112.37 188.5 ...

alrededor de 16 horas ago | 0

Answered

How do I convert strings stored in a cell array to numbers?

Here is a faster solution (which also does not rely of the evil eval hidden inside of str2num): >> C = {'Name','2/8','3/7','7/8...

How do I convert strings stored in a cell array to numbers?

Here is a faster solution (which also does not rely of the evil eval hidden inside of str2num): >> C = {'Name','2/8','3/7','7/8...

alrededor de 16 horas ago | 0

Answered

Trying to assign into multiple variables using a for loop

Use a cell array: N = s(1,1); C = cell(1,N); for k = 1:N C{k} = news(c,'Symbol',symbol(k),'Category',"Analyst Ratings");...

Trying to assign into multiple variables using a for loop

Use a cell array: N = s(1,1); C = cell(1,N); for k = 1:N C{k} = news(c,'Symbol',symbol(k),'Category',"Analyst Ratings");...

2 días ago | 0

Answered

combine 30.mat file having 1*15 matrix (Each .mat file having 1 row and 15 columns) to one .mat file

The best approach is to follow the examples in the MATLAB documentation: https://www.mathworks.com/help/matlab/import_export/pr...

combine 30.mat file having 1*15 matrix (Each .mat file having 1 row and 15 columns) to one .mat file

The best approach is to follow the examples in the MATLAB documentation: https://www.mathworks.com/help/matlab/import_export/pr...

2 días ago | 1

| accepted

Answered

Comparing cell with criteria

out1 = cellfun(@(l,r) setdiff(1:9,[l,r]), Spfcfef(:,1), Spfcfef(:,2), 'Uni',0); out2 = cellfun(@(l,r) setdiff(l,r), Spfcf...

Comparing cell with criteria

out1 = cellfun(@(l,r) setdiff(1:9,[l,r]), Spfcfef(:,1), Spfcfef(:,2), 'Uni',0); out2 = cellfun(@(l,r) setdiff(l,r), Spfcf...

2 días ago | 0

| accepted

Answered

Splitting a vector into separate vectors using thresholds

Simpler and more robust: >> x = [9,15,9,23,15,9,15,7,99,0,12] x = 9 15 9 23 15 9 15 7 99 ...

Splitting a vector into separate vectors using thresholds

Simpler and more robust: >> x = [9,15,9,23,15,9,15,7,99,0,12] x = 9 15 9 23 15 9 15 7 99 ...

3 días ago | 0

| accepted

Answered

How can I import multiple .CSV files in MATLAB with no sequential filename?

P = 'relative/absolute path to the folder where the files are saved'; S = dir(fullfile(P,'*.csv')); for k = 1:numel(S) F...

How can I import multiple .CSV files in MATLAB with no sequential filename?

P = 'relative/absolute path to the folder where the files are saved'; S = dir(fullfile(P,'*.csv')); for k = 1:numel(S) F...

3 días ago | 1

| accepted

Answered

Find function in matlab

find returns the indices of non-zero elements of an array. You provided find with a logical array with these values: >> a>10 a...

Find function in matlab

find returns the indices of non-zero elements of an array. You provided find with a logical array with these values: >> a>10 a...

3 días ago | 2

| accepted

Answered

What is the best way to create a vector with a special sequence of subvectors

Store the vectors in one matrix, then you just need to use nchoosek to generate the required indices: >> M = randi(9,5,3) % eac...

What is the best way to create a vector with a special sequence of subvectors

Store the vectors in one matrix, then you just need to use nchoosek to generate the required indices: >> M = randi(9,5,3) % eac...

3 días ago | 0

| accepted

Answered

Converting numbers into logicals

>> A = {[3;5;6;8],[2,3,5]}; % fake data >> B = cell2mat(cellfun(@(v)ismember(1:9,v),A(:),'UniformOutput',false)) B = 0 0 ...

Converting numbers into logicals

>> A = {[3;5;6;8],[2,3,5]}; % fake data >> B = cell2mat(cellfun(@(v)ismember(1:9,v),A(:),'UniformOutput',false)) B = 0 0 ...

3 días ago | 0

| accepted

Answered

Indexing a matrix with an array

Use a cell array, e.g.: C = {2,3}; % use NUM2CELL(I) if required. A(C{:}) Tested: >> A = rand(4,4) A = 0.340974 0.252...

Indexing a matrix with an array

Use a cell array, e.g.: C = {2,3}; % use NUM2CELL(I) if required. A(C{:}) Tested: >> A = rand(4,4) A = 0.340974 0.252...

4 días ago | 0

| accepted

Answered

Expanding the existing Matrix

Use repelem or kron, e.g. where V is your input vector: Z = repelem(V,24) or Z = kron(V,ones(24,1)) % adjust to suit V's orie...

Expanding the existing Matrix

Use repelem or kron, e.g. where V is your input vector: Z = repelem(V,24) or Z = kron(V,ones(24,1)) % adjust to suit V's orie...

4 días ago | 0

| accepted

Answered

How to concatenate a 3D cell array along the 3rd dimension?

In one line using num2cell, cellfun, and vertcat: >> C1 = cell(2,2,3); % preallocate cell array. >> C1(:) = cellfun(@(~)rand(1...

How to concatenate a 3D cell array along the 3rd dimension?

In one line using num2cell, cellfun, and vertcat: >> C1 = cell(2,2,3); % preallocate cell array. >> C1(:) = cellfun(@(~)rand(1...

4 días ago | 0

| accepted

Answered

How to find the element of a number if that number were to be placed in an ordered list?

The robust solution: >> ida = find(list<number,1,'last') ida = 3 >> idb = find(list>number,1,'first') idb = 4

How to find the element of a number if that number were to be placed in an ordered list?

The robust solution: >> ida = find(list<number,1,'last') ida = 3 >> idb = find(list>number,1,'first') idb = 4

5 días ago | 2

| accepted

Answered

fprintf can't make new line

Try opening the file in text mode, not binary mode: A = 5; tcl = regexp(fileread('old_file.tcl'), '[\n\r]+', 'split')'; tcl{3...

fprintf can't make new line

Try opening the file in text mode, not binary mode: A = 5; tcl = regexp(fileread('old_file.tcl'), '[\n\r]+', 'split')'; tcl{3...

5 días ago | 1

| accepted

Submitted

Number to Scientific Prefix

Convert a numeric value to an metric prefixed string (SI/engineering). Bonus: binary prefixes!

6 días ago | 24 downloads |

Submitted

Scientific Prefix to Number

Convert a metric prefixed string into numeric value (SI/engineering). Bonus: binary prefixes!

6 días ago | 10 downloads |

Answered

Same number of Rows and Cols of a matrix (N*N)

This will return false for non-square matrices, and also if ndims>2: isequal(0,diff(size(M))) It is easy to use with assert: ...

Same number of Rows and Cols of a matrix (N*N)

This will return false for non-square matrices, and also if ndims>2: isequal(0,diff(size(M))) It is easy to use with assert: ...

6 días ago | 0

Answered

complex plots bug?

"Am I doing something wrong or is this a bug in Matlab plotting?" There is no bug in the plotting. Exactly as documented, when...

complex plots bug?

"Am I doing something wrong or is this a bug in Matlab plotting?" There is no bug in the plotting. Exactly as documented, when...

6 días ago | 0

| accepted

Answered

How to store " first_element " values?

No loop needed, here using accumarray: >> A = [1,1,1,1,2,3,4,4,4;1,2,3,4,5,5,5,5,5] A = 1 1 1 1 2 3 4 4 4 ...

How to store " first_element " values?

No loop needed, here using accumarray: >> A = [1,1,1,1,2,3,4,4,4;1,2,3,4,5,5,5,5,5] A = 1 1 1 1 2 3 4 4 4 ...

6 días ago | 2

Answered

Converting a matrix of strings to a txt file

the format string need to have 3 conversion operators (or as many as you want on each line). the matrix needs to be tranposed. ...

Converting a matrix of strings to a txt file

the format string need to have 3 conversion operators (or as many as you want on each line). the matrix needs to be tranposed. ...

6 días ago | 1

| accepted

Answered

How to find duplicated values and calculate the mean of them?

Here is one solution: >> M = dlmread('all_velocities.txt'); >> [~,~,X] = unique(M(:,1:2),'rows'); >> F = @(x) mean(M(x,:),1)...

How to find duplicated values and calculate the mean of them?

Here is one solution: >> M = dlmread('all_velocities.txt'); >> [~,~,X] = unique(M(:,1:2),'rows'); >> F = @(x) mean(M(x,:),1)...

6 días ago | 0

Answered

Extracting specific values from a Matrix

Use sub2ind: >> V = randi(1024,1,1280); % fake vector of row indices. >> M = rand(1024,1280); % fake matrix of data. >> S ...

Extracting specific values from a Matrix

Use sub2ind: >> V = randi(1024,1,1280); % fake vector of row indices. >> M = rand(1024,1280); % fake matrix of data. >> S ...

7 días ago | 0

| accepted