Answered

Display a value from a Matrix based on user input

Note that your mykey is a string array. We typically use the term matrix only when referring to numeric arrays. Also note that ...

Display a value from a Matrix based on user input

Note that your mykey is a string array. We typically use the term matrix only when referring to numeric arrays. Also note that ...

19 days ago | 0

Answered

Error using imwrite in the following code

Yes, the documentation of imwrite doesn't say that you can path as input a folder and a filename. That's because you can't. imw...

Error using imwrite in the following code

Yes, the documentation of imwrite doesn't say that you can path as input a folder and a filename. That's because you can't. imw...

20 days ago | 0

Answered

For loop using unique values

Indeed using find would be madness. For the record, find is over used by beginners and is rarely needed. For that matters, for l...

For loop using unique values

Indeed using find would be madness. For the record, find is over used by beginners and is rarely needed. For that matters, for l...

20 days ago | 0

| accepted

Answered

Need help plotting multiple graphs

Please, don't post screenshots of code. We can't copy/paste screenshots into matlab to test your code. Post the code as text (an...

Need help plotting multiple graphs

Please, don't post screenshots of code. We can't copy/paste screenshots into matlab to test your code. Post the code as text (an...

20 days ago | 0

Answered

Calculate the mean of nonzero pixels

The loop was pointless to start with. All you're doing is: m = mean(volume .* mask, 'all'); %don't use mean as a variable name...

Calculate the mean of nonzero pixels

The loop was pointless to start with. All you're doing is: m = mean(volume .* mask, 'all'); %don't use mean as a variable name...

20 days ago | 1

| accepted

Answered

How to replace/delete some elements of a Matrix to a certain value

yourmatrix(randperm(numel(yourmatrix), numel(yourmatrix) * 0.1)) = 0; %replace 1/10th of the elements chosen at random by 0

How to replace/delete some elements of a Matrix to a certain value

yourmatrix(randperm(numel(yourmatrix), numel(yourmatrix) * 0.1)) = 0; %replace 1/10th of the elements chosen at random by 0

20 days ago | 0

| accepted

Answered

Replacing elements in a vector

So, simply subtract 59 from your vector: newvector = yourvector - 59;

Replacing elements in a vector

So, simply subtract 59 from your vector: newvector = yourvector - 59;

21 days ago | 1

Answered

I was looking for the code for the sample appdMemoryMonitorExample and could not find it

openExample('matlab/AppdMemoryMonitorExample') at matlab command prompt.

I was looking for the code for the sample appdMemoryMonitorExample and could not find it

openExample('matlab/AppdMemoryMonitorExample') at matlab command prompt.

21 days ago | 0

Answered

Error Index exceeds the number of array elements (151).

You define x as a vector of 151 elements: integers from 0 to 150, then you do: y = x+1; This defines y as a matrix the same s...

Error Index exceeds the number of array elements (151).

You define x as a vector of 151 elements: integers from 0 to 150, then you do: y = x+1; This defines y as a matrix the same s...

21 days ago | 0

Answered

How to add another column

yourtable.Age = yourtable.Rings + 1.5; by the sound of it. If not, then attach an example of your data as a mat file.

How to add another column

yourtable.Age = yourtable.Rings + 1.5; by the sound of it. If not, then attach an example of your data as a mat file.

21 days ago | 0

| accepted

Answered

GUI: How do save data from one callback to another ?

The handles structure that your callback receives is meant exactly for this: %It's a good idea to create the variable used in t...

GUI: How do save data from one callback to another ?

The handles structure that your callback receives is meant exactly for this: %It's a good idea to create the variable used in t...

21 days ago | 1

| accepted

Answered

addpath from a different subfolder of the same parent directory

Data folder should never be added to the search path. It's dangerous (you may change what functions are in scope) and there's no...

addpath from a different subfolder of the same parent directory

Data folder should never be added to the search path. It's dangerous (you may change what functions are in scope) and there's no...

21 days ago | 0

| accepted

Answered

What is best option to separate bytes from hex vector (char vector)?

Assuming that the number of characters is even: split = mat2cell(A, 1, repelem(2, numel(A)/2)) Note that this will produce a c...

What is best option to separate bytes from hex vector (char vector)?

Assuming that the number of characters is even: split = mat2cell(A, 1, repelem(2, numel(A)/2)) Note that this will produce a c...

22 days ago | 0

Answered

RSVP : REPLACE LETTERS WITH DIGITS

s = 'A':'Z'; %condition 1 numletters = randi([13, 21]); %number of letters to select is a random number from 13 to 21 lette...

RSVP : REPLACE LETTERS WITH DIGITS

s = 'A':'Z'; %condition 1 numletters = randi([13, 21]); %number of letters to select is a random number from 13 to 21 lette...

22 days ago | 1

| accepted

Answered

I would like to get matlab user guide

You can get the pdf documentation at: https://www.mathworks.com/help/pdf_doc/matlab/index.html. You will need to be logged into ...

I would like to get matlab user guide

You can get the pdf documentation at: https://www.mathworks.com/help/pdf_doc/matlab/index.html. You will need to be logged into ...

22 days ago | 0

Answered

Change names of files in a folder

In some ways your code is very well written with variable names that are descriptive and the correct functions used. In some oth...

Change names of files in a folder

In some ways your code is very well written with variable names that are descriptive and the correct functions used. In some oth...

22 days ago | 0

| accepted

Answered

Issues with Converting dates into the right datetime format

'Format' specifies the display format of datetime. It does not specify the format of the input to datetime. You specify this for...

Issues with Converting dates into the right datetime format

'Format' specifies the display format of datetime. It does not specify the format of the input to datetime. You specify this for...

22 days ago | 0

| accepted

Answered

datastore multiple delimiter (space, tab)

I should have spotted that straightaway, the way to specify control characters is with a backslash \, not a forward slash /. ds...

datastore multiple delimiter (space, tab)

I should have spotted that straightaway, the way to specify control characters is with a backslash \, not a forward slash /. ds...

22 days ago | 0

| accepted

Answered

Can i save excel files in app designer

You can save any variable of your App to excel, using either xlswrite or writetable. %... in the app class function SaveToExc...

Can i save excel files in app designer

You can save any variable of your App to excel, using either xlswrite or writetable. %... in the app class function SaveToExc...

22 days ago | 0

| accepted

Answered

Symmetric binary matrix with diagonal 0 values

Guaranteed to work on the first try: Msize = 10; %size of square matrix N = 20; %number of ones on each side of the diagonale...

Symmetric binary matrix with diagonal 0 values

Guaranteed to work on the first try: Msize = 10; %size of square matrix N = 20; %number of ones on each side of the diagonale...

23 days ago | 0

| accepted

Answered

Change Matlab Version from R2014a to R2018a

If you're going to upgrade, you may as well upgrade to the latest version, currently R2019b. Code that worked in 2018a should wo...

Change Matlab Version from R2014a to R2018a

If you're going to upgrade, you may as well upgrade to the latest version, currently R2019b. Code that worked in 2018a should wo...

23 days ago | 0

Answered

Index exceeds the number of array elements. Please Help?

Does anyone have any idea why i get the following error on line 15 Because the x you passed has less than 300 elements. Since i...

Index exceeds the number of array elements. Please Help?

Does anyone have any idea why i get the following error on line 15 Because the x you passed has less than 300 elements. Since i...

23 days ago | 0

Answered

Output must be a column vector

It looks like your error message comes from an ODE solver. It's the ODE solver that calls your function, so it's unclear what yo...

Output must be a column vector

It looks like your error message comes from an ODE solver. It's the ODE solver that calls your function, so it's unclear what yo...

23 days ago | 0

Answered

Vectorisation of code for insertion of n x n matrices in a 3D array along the diagonal of a large matrix

Note: I don't see how you can get a 4 at M(2, 1) if maxRand is 3. Here is one way, no guarantee that it's faster than a loop. W...

Vectorisation of code for insertion of n x n matrices in a 3D array along the diagonal of a large matrix

Note: I don't see how you can get a 4 at M(2, 1) if maxRand is 3. Here is one way, no guarantee that it's faster than a loop. W...

23 days ago | 0

Answered

Timer Interrupt in App Designer

app.t.TimerFcn = @app.DisplayFPS; %<--DisplayFPS is a method of the app, so must be called with app argument

Timer Interrupt in App Designer

app.t.TimerFcn = @app.DisplayFPS; %<--DisplayFPS is a method of the app, so must be called with app argument

23 days ago | 1

| accepted

Answered

parking space using IMAGE PROCESSING

You've cut the error message and removed the most important bit, the last part which told you which line of your code is respons...

parking space using IMAGE PROCESSING

You've cut the error message and removed the most important bit, the last part which told you which line of your code is respons...

23 days ago | 0

| accepted

Answered

Adding elements of a matrix based on an if condition

There is no rblush in your code. Note that sum(scalar_value) is simply scalar_value. The code you've written does not work at a...

Adding elements of a matrix based on an if condition

There is no rblush in your code. Note that sum(scalar_value) is simply scalar_value. The code you've written does not work at a...

25 days ago | 0

Answered

Help with using summation functions in matlab (Trying to create an atomic scatter function)

function scatterfactor = calculatescatteringfactor(Z, s, a, b) assert(numel(s) == 1, 's must be scalar'); assert(isequ...

Help with using summation functions in matlab (Trying to create an atomic scatter function)

function scatterfactor = calculatescatteringfactor(Z, s, a, b) assert(numel(s) == 1, 's must be scalar'); assert(isequ...

25 days ago | 0

Answered

find second minimum in a row in matlab without sorting

Use mink A = [ 3.5 2 1.6 1.456 0 1.9 2.6 ; 3.8 2.6 3.9 0 6 1.564 0 ]; minvals = mink(A, 2, 2); %first 2 miminums along dimen...

find second minimum in a row in matlab without sorting

Use mink A = [ 3.5 2 1.6 1.456 0 1.9 2.6 ; 3.8 2.6 3.9 0 6 1.564 0 ]; minvals = mink(A, 2, 2); %first 2 miminums along dimen...

25 days ago | 1

Answered

How to read .txt file and convert the characters of .txt into cell formation

You ought to read the documentation of the functions you use if you don't know how they work. fopen doesn't read a file. All it ...

How to read .txt file and convert the characters of .txt into cell formation

You ought to read the documentation of the functions you use if you don't know how they work. fopen doesn't read a file. All it ...

25 days ago | 0