Answered

Trouble reading csv file

This hack reads and parses your file %% str = fileread( '7000.csv' ); iszero = double(str) == 0; str(iszero) =...

Trouble reading csv file

This hack reads and parses your file %% str = fileread( '7000.csv' ); iszero = double(str) == 0; str(iszero) =...

3 months ago | 0

| accepted

Answered

How to zoom subplots together?

See <https://se.mathworks.com/help/matlab/ref/linkaxes.html linkaxes, Synchronize limits of specified 2-D axes> The first exa...

How to zoom subplots together?

See <https://se.mathworks.com/help/matlab/ref/linkaxes.html linkaxes, Synchronize limits of specified 2-D axes> The first exa...

3 months ago | 0

| accepted

Answered

divide matrix by a vector of the same number of column

I like this better. It avoids dividing by zero. ispos = B>0 C = A; C(:,ispos) = A(:,ispos) ./ B(ispos) Requires "I...

divide matrix by a vector of the same number of column

I like this better. It avoids dividing by zero. ispos = B>0 C = A; C(:,ispos) = A(:,ispos) ./ B(ispos) Requires "I...

3 months ago | 1

Answered

Is there a way in MATLAB to make a boundary and have it skip over data pairs?

Documentation of the function, *|boundary(x,y)|*, says * *|x|* and *|y|* shall be column vectors * *|x|* and *|y|* shall be...

Is there a way in MATLAB to make a boundary and have it skip over data pairs?

Documentation of the function, *|boundary(x,y)|*, says * *|x|* and *|y|* shall be column vectors * *|x|* and *|y|* shall be...

3 months ago | 0

| accepted

Answered

Vectorising a for loop that creates a 2-D surface for each point in a Domain

Matlab loops are faster than their reputation. I believe it's difficult to significantly outperform this function function...

Vectorising a for loop that creates a 2-D surface for each point in a Domain

Matlab loops are faster than their reputation. I believe it's difficult to significantly outperform this function function...

3 months ago | 0

| accepted

Answered

Sum of N matrices

I've modified the example of my comment. %% n = 12; sz = [3,3]; MKG = nan( sz(1),sz(2), n ); for ix = 1 : ...

Sum of N matrices

I've modified the example of my comment. %% n = 12; sz = [3,3]; MKG = nan( sz(1),sz(2), n ); for ix = 1 : ...

3 months ago | 0

| accepted

Answered

Problem with dlmread()

That depends on the format of your txt-files. Here is a simple case %% R2018a fid = fopen('rugged.txt'); cac = tex...

Problem with dlmread()

That depends on the format of your txt-files. Here is a simple case %% R2018a fid = fopen('rugged.txt'); cac = tex...

3 months ago | 0

| accepted

Answered

Function with 2 variables

See <https://se.mathworks.com/help/matlab/ref/log.html log, Natural logarithm> and try >> ZP=[-41 -45 -53]; SA=[0.001 0....

Function with 2 variables

See <https://se.mathworks.com/help/matlab/ref/log.html log, Natural logarithm> and try >> ZP=[-41 -45 -53]; SA=[0.001 0....

3 months ago | 0

Answered

An error (Two different outputs for a single command)

*|k_|* is a row vector, which explains why *|gamma|* becomes a row vector >> whos k_ gamma Name Size ...

An error (Two different outputs for a single command)

*|k_|* is a row vector, which explains why *|gamma|* becomes a row vector >> whos k_ gamma Name Size ...

3 months ago | 0

| accepted

Answered

how do i get the last points of every 100 points from a 1000 point graph

_"how do i get the last points of every [sequence of] 100 points from a [sequence of] 1000 point[s]"_ That's my interpreta...

how do i get the last points of every 100 points from a 1000 point graph

_"how do i get the last points of every [sequence of] 100 points from a [sequence of] 1000 point[s]"_ That's my interpreta...

4 months ago | 0

| accepted

Answered

MatLab isn't reading the entirety of my data?

AFAIK: *|dir|* is the only function that takes wildcards in folder names. *Doc on |dir| says:* [...] To search through fo...

MatLab isn't reading the entirety of my data?

AFAIK: *|dir|* is the only function that takes wildcards in folder names. *Doc on |dir| says:* [...] To search through fo...

4 months ago | 0

| accepted

Answered

Singleton error causing mismatch?

Try replacing report(i,1)=props(i).name; by report(i,1)={props(i).name}; and see <https://se.mathworks.com/help...

Singleton error causing mismatch?

Try replacing report(i,1)=props(i).name; by report(i,1)={props(i).name}; and see <https://se.mathworks.com/help...

4 months ago | 0

Answered

MYSTERY matlab Error - Index exceeds matrix dimensions - can't track it!

* *B is overwritten* at line 43 and the following loop. * In the second and the following iterations of the outer loop, *|t>...

MYSTERY matlab Error - Index exceeds matrix dimensions - can't track it!

* *B is overwritten* at line 43 and the following loop. * In the second and the following iterations of the outer loop, *|t>...

4 months ago | 0

Answered

Creating a class object with the same class name as a variable

You could create a function, *|factory|*, to communicate the intent. K = 'a1'; obj = factory( K ); where functio...

Creating a class object with the same class name as a variable

You could create a function, *|factory|*, to communicate the intent. K = 'a1'; obj = factory( K ); where functio...

4 months ago | 0

Answered

Need help. I have extract a specific column from file and it contains zeros. How to remove those zero so it can match the vector and can be plotted??

Try Col(Col==0)=[];

Need help. I have extract a specific column from file and it contains zeros. How to remove those zero so it can match the vector and can be plotted??

Try Col(Col==0)=[];

4 months ago | 0

| accepted

Answered

Extracting parts of a string

Is this what you are looking for? %% fid = fopen( '00000090Head.txt', 'r' ); cac = textscan( fid, '%*s%f%*f%*f%*f%...

Extracting parts of a string

Is this what you are looking for? %% fid = fopen( '00000090Head.txt', 'r' ); cac = textscan( fid, '%*s%f%*f%*f%*f%...

4 months ago | 1

Answered

Matrix indexing and plotting related doubt.

It seems as if you need to use *|squeeze|* to get a 2D matrix %% mat = zeros( 20, 50, 187 ); len = numel( mat ); m...

Matrix indexing and plotting related doubt.

It seems as if you need to use *|squeeze|* to get a 2D matrix %% mat = zeros( 20, 50, 187 ); len = numel( mat ); m...

4 months ago | 0

Answered

Generate a Definite timestamp sequence

The old way >> vec = repmat([2018,3,1,0,0,0], 31*24*12, 1 ); >> minutes = ( 0 : 5 : 5*(31*24*12-1) )'; >> vec(:,5) = ...

Generate a Definite timestamp sequence

The old way >> vec = repmat([2018,3,1,0,0,0], 31*24*12, 1 ); >> minutes = ( 0 : 5 : 5*(31*24*12-1) )'; >> vec(:,5) = ...

4 months ago | 0

Answered

Plot: dealing with data available only on weekdays

I assume * *|X|* and *|Y|* have the same length * *|Z|* is shorter than *|X|* * *|Y|* and *|Z|* hold one value per day * ...

Plot: dealing with data available only on weekdays

I assume * *|X|* and *|Y|* have the same length * *|Z|* is shorter than *|X|* * *|Y|* and *|Z|* hold one value per day * ...

4 months ago | 0

Answered

Sum of base exponentials e

Matlab is clever >> 5*sum( exp(x1), 2 ) ans = 1.0e+04 * 5.545715485358022 0.017431824560524

Sum of base exponentials e

Matlab is clever >> 5*sum( exp(x1), 2 ) ans = 1.0e+04 * 5.545715485358022 0.017431824560524

5 months ago | 0

| accepted

Answered

How to move files based one whether their name is contained in a spreadsheet?

>> cssm moves the files <</matlabcentral/answers/uploaded_files/119096/snip_20180526101155.png>> where ...

How to move files based one whether their name is contained in a spreadsheet?

>> cssm moves the files <</matlabcentral/answers/uploaded_files/119096/snip_20180526101155.png>> where ...

5 months ago | 1

| accepted

Answered

Arrow between two subplots

See <https://se.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.line-properties.html Line Properties>. Set the val...

Arrow between two subplots

See <https://se.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.line-properties.html Line Properties>. Set the val...

5 months ago | 0

Answered

Attempt to execute SCRIPT builtin as a function:

*PLS_Toolbox_852* is the name of a toolbox by <http://www.eigenvector.com/software/pls_toolbox.htm Eigenvector Research, Inc>. K...

Attempt to execute SCRIPT builtin as a function:

*PLS_Toolbox_852* is the name of a toolbox by <http://www.eigenvector.com/software/pls_toolbox.htm Eigenvector Research, Inc>. K...

5 months ago | 0

Answered

Can someone tell me why I keep getting parse and syntax errors here?

To make your code more readable, I formatted it and in that process added a closing *|end|*. Now, your code works just fine ...

Can someone tell me why I keep getting parse and syntax errors here?

To make your code more readable, I formatted it and in that process added a closing *|end|*. Now, your code works just fine ...

5 months ago | 0

Answered

What does this Error code mean ?

Deep in the code of Matlab itself Handle input argument contains non handle values a nonhandle value was passed where ...

What does this Error code mean ?

Deep in the code of Matlab itself Handle input argument contains non handle values a nonhandle value was passed where ...

5 months ago | 0

Answered

Help using Regexp:

One way >> str='Some.Text {a1=v1 a2=v2}'; >> cac = regexp( str, '(?<={)[^}]+(?=})', 'once', 'match' ) cac = a1=v1 ...

Help using Regexp:

One way >> str='Some.Text {a1=v1 a2=v2}'; >> cac = regexp( str, '(?<={)[^}]+(?=})', 'once', 'match' ) cac = a1=v1 ...

5 months ago | 0

| accepted

Answered

Creating a vector with nested for loops and a while loop

One way >> cssm ans = 2 4 8 16 32 64 128 256 >> where function vector = cssm ...

Creating a vector with nested for loops and a while loop

One way >> cssm ans = 2 4 8 16 32 64 128 256 >> where function vector = cssm ...

5 months ago | 1

| accepted

Answered

MATLAB writing text file “invalid permission” in UBUNTU

Doc says: <https://se.mathworks.com/help/matlab/ref/fopen.html?searchHighlight=fopen&s_tid=doc_srchtitle fileID = fopen(filename...

MATLAB writing text file “invalid permission” in UBUNTU

Doc says: <https://se.mathworks.com/help/matlab/ref/fopen.html?searchHighlight=fopen&s_tid=doc_srchtitle fileID = fopen(filename...

5 months ago | 0

| accepted

Answered

Transferring 4 already plotted figures into one with subplots

AFAIK: Matlab doesn't provide a specific tool to copy the content of separate figures to subplots of one figure. However, there ...

Transferring 4 already plotted figures into one with subplots

AFAIK: Matlab doesn't provide a specific tool to copy the content of separate figures to subplots of one figure. However, there ...

5 months ago | 0

Answered

How can I remove a duplicate set values?

I guess * *|d|* is a row vector of whole numbers * *|d|* consists of multiple sets of *three* numbers * you s...

How can I remove a duplicate set values?

I guess * *|d|* is a row vector of whole numbers * *|d|* consists of multiple sets of *three* numbers * you s...

5 months ago | 1