Answered

How to overlay randomized point grid on photo?

I = imread( 'MyImage.png' ) ; x = rand( 1, 50 ) * size( I, 2 ) ; y = rand( 1, 50 ) * size( I, 1 ) ; imshow( I ) ; h...

How to overlay randomized point grid on photo?

I = imread( 'MyImage.png' ) ; x = rand( 1, 50 ) * size( I, 2 ) ; y = rand( 1, 50 ) * size( I, 1 ) ; imshow( I ) ; h...

bijna 5 jaar ago | 0

Answered

Deleting Nonzero elements in each row

Here is one way: >> A A = 0 0 5 5 4 1 0 1 3 0 4 2 0 0 3...

Deleting Nonzero elements in each row

Here is one way: >> A A = 0 0 5 5 4 1 0 1 3 0 4 2 0 0 3...

bijna 5 jaar ago | 0

Answered

How to group rows of data into a cell of a cell array?

Here is one way. We start by building a fake data set: >> A = [rand(10,3), randi(2,10,3)] A = 0.7513 0.8407 0.3...

How to group rows of data into a cell of a cell array?

Here is one way. We start by building a fake data set: >> A = [rand(10,3), randi(2,10,3)] A = 0.7513 0.8407 0.3...

bijna 5 jaar ago | 1

| accepted

Answered

calling a function in another function by changing only few input arguments

If you are in another function where variables with the same names are defined (e.g. because they are arguments of the function)...

calling a function in another function by changing only few input arguments

If you are in another function where variables with the same names are defined (e.g. because they are arguments of the function)...

bijna 5 jaar ago | 0

| accepted

Answered

how to convert collumn matrix (nxn) into another matrix of (mxn) type .

Difficult to answer with that little detail.. Maybe: M = reshape( v, n, n ) ; or M = reshape( v, n, [] ) ; with a...

how to convert collumn matrix (nxn) into another matrix of (mxn) type .

Difficult to answer with that little detail.. Maybe: M = reshape( v, n, n ) ; or M = reshape( v, n, [] ) ; with a...

bijna 5 jaar ago | 0

Answered

How i can remove HTML tags

content = regexprep( content, '<.*?>', '' ) ; *EDIT:* and the following thread just came back, with Sean mentioning the Text...

How i can remove HTML tags

content = regexprep( content, '<.*?>', '' ) ; *EDIT:* and the following thread just came back, with Sean mentioning the Text...

bijna 5 jaar ago | 2

Answered

Accessing the string elements

Here is one way, as string arrays are "iterable". continents = ["America", "Europe"] ; countries.America = ["USA", "Bra...

Accessing the string elements

Here is one way, as string arrays are "iterable". continents = ["America", "Europe"] ; countries.America = ["USA", "Bra...

bijna 5 jaar ago | 3

| accepted

Answered

Export Data from a Structure which contains double timeseries data to Excel ... Example Data Provided...

Here is one way if you want to create two worksheets "Left" and "Right" in the same workbook, with 21 column per sheet for time ...

Export Data from a Structure which contains double timeseries data to Excel ... Example Data Provided...

Here is one way if you want to create two worksheets "Left" and "Right" in the same workbook, with 21 column per sheet for time ...

bijna 5 jaar ago | 2

| accepted

Answered

Extracting multiple envelopes from a signal

Quick cheap trick gets 2/3. Was going to bed, no time for more but that could be a starting point. function main load...

Extracting multiple envelopes from a signal

Quick cheap trick gets 2/3. Was going to bed, no time for more but that could be a starting point. function main load...

bijna 5 jaar ago | 2

| accepted

Answered

Sort & Index matrix for highest values in row

Here is another way: >> A = rand(5, 5) A = 0.9337 0.1518 0.6164 0.3074 0.4584 0.9017 0.1290 0....

Sort & Index matrix for highest values in row

Here is another way: >> A = rand(5, 5) A = 0.9337 0.1518 0.6164 0.3074 0.4584 0.9017 0.1290 0....

bijna 5 jaar ago | 1

Answered

Best way to seperate a very large array of numbers into different variables based on a value tat is given in the first column?

Here is an example: we build a fake data set: >> data = [sort(randi(3,10,1)), rand(10,5)] data = 1.0000 0.9727 ...

Best way to seperate a very large array of numbers into different variables based on a value tat is given in the first column?

Here is an example: we build a fake data set: >> data = [sort(randi(3,10,1)), rand(10,5)] data = 1.0000 0.9727 ...

bijna 5 jaar ago | 1

| accepted

Answered

find all the possible pairs with postive elements from a given matrix

It looks like you want triplets, or I don't understand the question: >> posUnique = unique( A(A > 0) ) posUnique = ...

find all the possible pairs with postive elements from a given matrix

It looks like you want triplets, or I don't understand the question: >> posUnique = unique( A(A > 0) ) posUnique = ...

bijna 5 jaar ago | 1

Answered

indexing entry of a matrix result

[nRows, nCols] = size( A ) ; if you don't need |nRows|: [~, nCols] = size( A ) ;

indexing entry of a matrix result

[nRows, nCols] = size( A ) ; if you don't need |nRows|: [~, nCols] = size( A ) ;

bijna 5 jaar ago | 1

| accepted

Answered

Figure size for multiple subplots is not even

At the end AX.Position(1:2) = [0.005, 0.02] ; % Move legend down and center a bit. ax2.Position(4) = ax1.Position(4...

Figure size for multiple subplots is not even

At the end AX.Position(1:2) = [0.005, 0.02] ; % Move legend down and center a bit. ax2.Position(4) = ax1.Position(4...

bijna 5 jaar ago | 1

| accepted

Answered

concatenated matrix - factoring out a matrix coefficient

D = [A, B]./[C, C] which isn't more convenient than the initial expression! Depending the context, you can REPELEM or REPM...

concatenated matrix - factoring out a matrix coefficient

D = [A, B]./[C, C] which isn't more convenient than the initial expression! Depending the context, you can REPELEM or REPM...

bijna 5 jaar ago | 1

| accepted

Answered

How do I properly append to an array within a loop?

You shouldn't name your variable |Ai| if |i| is meant to be the index. Assuming that |A| is already defined and that, at loop in...

How do I properly append to an array within a loop?

You shouldn't name your variable |Ai| if |i| is meant to be the index. Assuming that |A| is already defined and that, at loop in...

bijna 5 jaar ago | 3

Answered

How to make a permanent change to a matrix using sortrows?

P = sortrows(P,7) ; Most of the time functions don't operate "externally", so SORTROWS doesn't alter your array |P| define...

How to make a permanent change to a matrix using sortrows?

P = sortrows(P,7) ; Most of the time functions don't operate "externally", so SORTROWS doesn't alter your array |P| define...

bijna 5 jaar ago | 1

| accepted

Answered

How to make this "for" loop work?

s = [1.2535 1.2535 1.2535] c = [0.0 0.5 1.0] Formula = zeros( numel(s), numel(c) ) ; for i=1:3 for j=1:3 ...

How to make this "for" loop work?

s = [1.2535 1.2535 1.2535] c = [0.0 0.5 1.0] Formula = zeros( numel(s), numel(c) ) ; for i=1:3 for j=1:3 ...

bijna 5 jaar ago | 1

| accepted

Answered

Wanted: Examples on how to use "Dynamic Regular Expressions" to debug regular expressions

Regular expressions may not be that appropriate in this context; I used them in the past for doing exactly this, but it was too ...

Wanted: Examples on how to use "Dynamic Regular Expressions" to debug regular expressions

Regular expressions may not be that appropriate in this context; I used them in the past for doing exactly this, but it was too ...

bijna 5 jaar ago | 1

Answered

textscan failing to read data in text file

Here is one way. We pre-process the content before parsing, adding 'N' where the first letter is missing. Then we count the numb...

textscan failing to read data in text file

Here is one way. We pre-process the content before parsing, adding 'N' where the first letter is missing. Then we count the numb...

bijna 5 jaar ago | 2

| accepted

Answered

How to unnest nested cell arrays??

It is a very good attempt. Here is an example that is almost what you did: >> A = {{5,6}; {7}; {8,9,3}} A = 3×1 cell ar...

How to unnest nested cell arrays??

It is a very good attempt. Here is an example that is almost what you did: >> A = {{5,6}; {7}; {8,9,3}} A = 3×1 cell ar...

bijna 5 jaar ago | 1

| accepted

Answered

basic math operations with numbers stored in cell arrays ?

You probably have strings in the table and not numbers. If so, you should use STR2DOUBLE instead of CELL2MAT. It can operate on ...

basic math operations with numbers stored in cell arrays ?

You probably have strings in the table and not numbers. If so, you should use STR2DOUBLE instead of CELL2MAT. It can operate on ...

bijna 5 jaar ago | 0

| accepted

Answered

How to cut duplicate rows from a matrix

A_uniqueRows = unique( A, 'rows' ) ; or A_uniqueRows = unique( A, 'rows', 'stable' ) ; if you don't want the outpu...

How to cut duplicate rows from a matrix

A_uniqueRows = unique( A, 'rows' ) ; or A_uniqueRows = unique( A, 'rows', 'stable' ) ; if you don't want the outpu...

bijna 5 jaar ago | 0

| accepted

Answered

Get data points from one line

That was a good attempt, but for this you should use tokens: buffer = fileread( 'SnSe_100K_17.out' ) ; pattern = ':\s+(\S...

Get data points from one line

That was a good attempt, but for this you should use tokens: buffer = fileread( 'SnSe_100K_17.out' ) ; pattern = ':\s+(\S...

bijna 5 jaar ago | 0

| accepted

Answered

After reading excel data into matlab the data is not complete

Look at the possible output arguments of XLSREAD. The function splits numeric and text data, and also outputs raw data: [num...

After reading excel data into matlab the data is not complete

Look at the possible output arguments of XLSREAD. The function splits numeric and text data, and also outputs raw data: [num...

bijna 5 jaar ago | 0

Answered

Search an entire text file for a word

content = fileread( 'MyTextFile.txt' ) ; and then you can STRFIND or REGEXP or anything else on |content|, which is a char...

Search an entire text file for a word

content = fileread( 'MyTextFile.txt' ) ; and then you can STRFIND or REGEXP or anything else on |content|, which is a char...

bijna 5 jaar ago | 0

| accepted

Answered

Read specific column from .txt file with unkown format

content = fileread( 'Info.txt' ) ; nCols = numel( strsplit( regexp( content, '[^\r\n]+', 'match', 'once' ), ' ')) ; dat...

Read specific column from .txt file with unkown format

content = fileread( 'Info.txt' ) ; nCols = numel( strsplit( regexp( content, '[^\r\n]+', 'match', 'once' ), ' ')) ; dat...

bijna 5 jaar ago | 1

| accepted

Answered

How can I format fscanf to read strings of different lengths, some with spaces in them?

Wild guess: cometNames = strtrim( strsplit( fileread( 'MyFile.txt' ), ',' )) ; will work, provided that you adapt the del...

How can I format fscanf to read strings of different lengths, some with spaces in them?

Wild guess: cometNames = strtrim( strsplit( fileread( 'MyFile.txt' ), ',' )) ; will work, provided that you adapt the del...

bijna 5 jaar ago | 0

Answered

How to convert a string to a function?

doc str2func but unless you know what you are doing (or you are just playing to see how that works), approaches that rely ...

How to convert a string to a function?

doc str2func but unless you know what you are doing (or you are just playing to see how that works), approaches that rely ...

bijna 5 jaar ago | 2

| accepted

Answered

Identifying sequences in a Matrix

You can find sequences using STRFIND, even when you are dealing with numbers: >> seq_str = 'ACEBAECE' ; >> strfind( seq_st...

Identifying sequences in a Matrix

You can find sequences using STRFIND, even when you are dealing with numbers: >> seq_str = 'ACEBAECE' ; >> strfind( seq_st...

bijna 5 jaar ago | 1

| accepted