Answered

Function with a structural array

Concatenation is done using square brackets |[]|. Curly brackets are for defining cell arrays. Also, while it is a question of p...

Function with a structural array

Concatenation is done using square brackets |[]|. Curly brackets are for defining cell arrays. Also, while it is a question of p...

ongeveer 5 jaar ago | 2

| accepted

Answered

Subplots within for loops

figure() ; for plotId = 1 : 4 subplot(2, 2, plotId) ; plot(x{plotId}, y{plotId}) ; end figure() ; for plo...

Subplots within for loops

figure() ; for plotId = 1 : 4 subplot(2, 2, plotId) ; plot(x{plotId}, y{plotId}) ; end figure() ; for plo...

ongeveer 5 jaar ago | 7

| accepted

Answered

overlay plot on imgage

hold on for overlays, for example: imshow( myImage ) ; hold on ; plot( x, y, 'rx' ) ; and you will see the plot...

overlay plot on imgage

hold on for overlays, for example: imshow( myImage ) ; hold on ; plot( x, y, 'rx' ) ; and you will see the plot...

ongeveer 5 jaar ago | 1

| accepted

Answered

How to find intersection coordinates of node points in truss image?

If you are always dealing with regular trusses, your best option may be to detect vertical and horizontal edges by summation ove...

How to find intersection coordinates of node points in truss image?

If you are always dealing with regular trusses, your best option may be to detect vertical and horizontal edges by summation ove...

ongeveer 5 jaar ago | 1

| accepted

Answered

How to match and take the part of the string between two specified characters

Replace the line that extracts the start time with: startTime = strtrim( regexp( content, '(?<=Start Time\s+:\s*).*?(?= - )...

How to match and take the part of the string between two specified characters

Replace the line that extracts the start time with: startTime = strtrim( regexp( content, '(?<=Start Time\s+:\s*).*?(?= - )...

ongeveer 5 jaar ago | 2

Answered

How to take only first part of the string

Assuming that all cells content is of class char: B = [A(:,1), cellfun(@(s)regexp(s, '\S+', 'match', 'once'), A(:,2:3), 'Uni...

How to take only first part of the string

Assuming that all cells content is of class char: B = [A(:,1), cellfun(@(s)regexp(s, '\S+', 'match', 'once'), A(:,2:3), 'Uni...

ongeveer 5 jaar ago | 0

Answered

Using fprintf to print in text file

The first argument in the call to FPRINTF should not be the file name but the file handle that you get with FOPEN: kid = fop...

Using fprintf to print in text file

The first argument in the call to FPRINTF should not be the file name but the file handle that you get with FOPEN: kid = fop...

ongeveer 5 jaar ago | 0

Answered

Replacing numerics in text using regular expressions.

Here is a small trick assuming that no character in your string interferes with <https://www.mathworks.com/help/matlab/ref/sprin...

Replacing numerics in text using regular expressions.

Here is a small trick assuming that no character in your string interferes with <https://www.mathworks.com/help/matlab/ref/sprin...

ongeveer 5 jaar ago | 1

| accepted

Answered

How to split the name in to two cells

Or regexp-based: if C = {'56', 'mat find false', '89 mm', 'mat 96 kl'} ; then result = regexp(C, '(mat)?\s?(.*)', 't...

How to split the name in to two cells

Or regexp-based: if C = {'56', 'mat find false', '89 mm', 'mat 96 kl'} ; then result = regexp(C, '(mat)?\s?(.*)', 't...

ongeveer 5 jaar ago | 2

| accepted

Answered

Sorting excel data (numbers and strings) and outputting sorted data to another excel file.

*EDIT 09/27 @ 22:57 UTC* I updated your file and attached it to my answer (Data_original.xlsx). I picked on number (093321, d...

Sorting excel data (numbers and strings) and outputting sorted data to another excel file.

*EDIT 09/27 @ 22:57 UTC* I updated your file and attached it to my answer (Data_original.xlsx). I picked on number (093321, d...

ongeveer 5 jaar ago | 2

| accepted

Answered

Detect Edge in picture with low contrast

Well, that picked my interest so I just spent a lunch break on it. Running the following using the |process| function attached (...

Detect Edge in picture with low contrast

Well, that picked my interest so I just spent a lunch break on it. Running the following using the |process| function attached (...

ongeveer 5 jaar ago | 6

| accepted

Answered

Dividing a cell array into permutations of two column cell

*EDIT 1:* Here it goes: words = {'A', 'B', 'C', 'D'} ; n = length( words ) ; wordIds = arrayfun( @(k) nchoosek( 1:n...

Dividing a cell array into permutations of two column cell

*EDIT 1:* Here it goes: words = {'A', 'B', 'C', 'D'} ; n = length( words ) ; wordIds = arrayfun( @(k) nchoosek( 1:n...

ongeveer 5 jaar ago | 1

Answered

How to convert cell array with Nan to a double array with Nan=0?

x = cell2mat(C) ; x(isnan(x)) = 0 ;

How to convert cell array with Nan to a double array with Nan=0?

x = cell2mat(C) ; x(isnan(x)) = 0 ;

ongeveer 5 jaar ago | 1

Answered

How to extract a row from a transpose of a matrix

Take the first column of the original matrix.

How to extract a row from a transpose of a matrix

Take the first column of the original matrix.

ongeveer 5 jaar ago | 3

Answered

MatLab Logical answer always 1

Yes, all these tests (relational operators) return a logical, which is a value that is true (1) or false (0). But: >> 5 <...

MatLab Logical answer always 1

Yes, all these tests (relational operators) return a logical, which is a value that is true (1) or false (0). But: >> 5 <...

ongeveer 5 jaar ago | 3

| accepted

Answered

Define an input that is ONLY a 3-by-4 matrix

You can use specialized functions described here: <https://www.mathworks.com/help/matlab/input-and-output-arguments.html> ...

Define an input that is ONLY a 3-by-4 matrix

You can use specialized functions described here: <https://www.mathworks.com/help/matlab/input-and-output-arguments.html> ...

ongeveer 5 jaar ago | 1

Answered

How is it possible that Matlab still hasn't created a built in function that automatically inserts a title above a group of subplots?

When you start getting picky, you don't use SUBPLOT anymore because it is not that flexible. Instead you create an axes object t...

How is it possible that Matlab still hasn't created a built in function that automatically inserts a title above a group of subplots?

When you start getting picky, you don't use SUBPLOT anymore because it is not that flexible. Instead you create an axes object t...

ongeveer 5 jaar ago | 4

Answered

Import an Excel File

I think that I am starting to see what you did, and it is not something that we generally do actually, hence the misunderstandin...

Import an Excel File

I think that I am starting to see what you did, and it is not something that we generally do actually, hence the misunderstandin...

ongeveer 5 jaar ago | 1

| accepted

Answered

How to remove repeating rows without unique function?

Use the |'stable'| option: >> A = randi( 3, 10, 2 ) A = 2 3 1 1 3 1 3 1 3 ...

How to remove repeating rows without unique function?

Use the |'stable'| option: >> A = randi( 3, 10, 2 ) A = 2 3 1 1 3 1 3 1 3 ...

ongeveer 5 jaar ago | 2

| accepted

Answered

I am trying to solve following error in my code, Error using .* Matrix dimensions must agree.

If you got this code from someone else and it should be working (because it used to work with the exact same parameters), my gue...

I am trying to solve following error in my code, Error using .* Matrix dimensions must agree.

If you got this code from someone else and it should be working (because it used to work with the exact same parameters), my gue...

ongeveer 5 jaar ago | 1

| accepted

Answered

How do I read a text file with certain format line by line with each line of different length?

There are more orthodox solutions, but I updated a former answer quickly in case you need a short term solution. The only assump...

How do I read a text file with certain format line by line with each line of different length?

There are more orthodox solutions, but I updated a former answer quickly in case you need a short term solution. The only assump...

ongeveer 5 jaar ago | 0

| accepted

Answered

How to remove artifacts from a signal

Why not simply: d = [0; diff( signal )] ; isValid = ~logical( cumsum( -sign( d ) .* (abs( d ) > 10) )) ; then e.g...

How to remove artifacts from a signal

Why not simply: d = [0; diff( signal )] ; isValid = ~logical( cumsum( -sign( d ) .* (abs( d ) > 10) )) ; then e.g...

ongeveer 5 jaar ago | 6

Answered

reshape a matrix from the text

The output of TEXTSCAN is a row cell array with 4 cells and each one of them contains a numeric array (column vector) of 2250 va...

reshape a matrix from the text

The output of TEXTSCAN is a row cell array with 4 cells and each one of them contains a numeric array (column vector) of 2250 va...

ongeveer 5 jaar ago | 0

Answered

how to read grid data from text file ?

The format seems to be GridTOMS as mentioned <https://acd-ext.gsfc.nasa.gov/Data_services/cloud_slice/new_data.html here>. There...

how to read grid data from text file ?

The format seems to be GridTOMS as mentioned <https://acd-ext.gsfc.nasa.gov/Data_services/cloud_slice/new_data.html here>. There...

ongeveer 5 jaar ago | 1

| accepted

Answered

How Can I replace specific lines in a text file

Here is an example, but we can be much more specific. % - Read source. content = fileread( 'myData.txt' ) ; % - Update...

How Can I replace specific lines in a text file

Here is an example, but we can be much more specific. % - Read source. content = fileread( 'myData.txt' ) ; % - Update...

ongeveer 5 jaar ago | 5

| accepted

Answered

Comparing Elements of two matrices if loop

Or you can operate in 3D: A = [-10, 2, -8, 4; ... -4, 6, -3, 7; ... 2, 5, 3, 6] ; B = [ 3, 6; ... ...

Comparing Elements of two matrices if loop

Or you can operate in 3D: A = [-10, 2, -8, 4; ... -4, 6, -3, 7; ... 2, 5, 3, 6] ; B = [ 3, 6; ... ...

ongeveer 5 jaar ago | 0

Answered

How to check whether a 2d matrix is gradually increasing in values in row direction.

>> flags = [false( 1, size( A, 2 )); diff( A ) < 0] flags = 2×3 logical array 0 0 0 0 0 1 >> A(flags...

How to check whether a 2d matrix is gradually increasing in values in row direction.

>> flags = [false( 1, size( A, 2 )); diff( A ) < 0] flags = 2×3 logical array 0 0 0 0 0 1 >> A(flags...

ongeveer 5 jaar ago | 1

Answered

How to import data from a non-symmetric .txt file.

If you are stuck with usual tools, try this: content = fileread( 'virusDat.txt' ) ; % - Split in rows, remove extra empt...

How to import data from a non-symmetric .txt file.

If you are stuck with usual tools, try this: content = fileread( 'virusDat.txt' ) ; % - Split in rows, remove extra empt...

ongeveer 5 jaar ago | 1

Answered

Extracting and Manipulating Data

Looking at your data: data = xlsread( 'data2016.csv' ) ; and displaying a slice: 0.0001 0.0026 0.0021 0.0...

Extracting and Manipulating Data

Looking at your data: data = xlsread( 'data2016.csv' ) ; and displaying a slice: 0.0001 0.0026 0.0021 0.0...

ongeveer 5 jaar ago | 0

Answered

Processing timer for Sparse matrix is too long?

You won't be able to do it, vectorizing or not. If random integers are really in |1:7|, the probability, when you pick two el...

Processing timer for Sparse matrix is too long?

You won't be able to do it, vectorizing or not. If random integers are really in |1:7|, the probability, when you pick two el...

ongeveer 5 jaar ago | 2

| accepted