Réponse apportée
Invalidate user entry by using isnan or isempty function
str2double returns NaN (not-a-number) when it cannot convert text to a number. You can therefore simply use isnan to test if a n...

plus de 3 ans il y a | 0

Réponse apportée
Combinations of array rows with exclusion
This answer does not have any of the duplicates that are present in my previous answer: A = [20 10;20 15;20 30;22 15;25 10; 30 ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Combinations of array rows with exclusion
OK, so how about this? A = [20 10;20 15;20 30;22 15;25 10; 30 10]; cellArr{1} = deleteOneRow(A); for i = 2:size(A,1)-4 ...

plus de 3 ans il y a | 1

Réponse apportée
Code for action when ui toggle button is pressed
Yes, that's indeed the problem - the selected button never changes because you only have one button in the button group, so the ...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
error on using fplot
Your solution usol contains two symbolic variables, x and d, but fplot can only deal with functions of a single variable. I supp...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Display same image with different rotations
I assume you are talking about 2D images: % prepare an image but hide it initially (for better timing) h = imagesc(peaks, 'Vis...

plus de 3 ans il y a | 0

Réponse apportée
Combining Two plots with different with the same y axis and different x axis length
If the widths of your two plot boxes have an integer ratio (such as 4:1), you can use tiledlayout to do this. First create one r...

plus de 3 ans il y a | 0

Réponse apportée
How do I write a code to rearrage the colors in an RGB color array?
The third dimension of your 229x600 image contains the rgb values for each pixel: image1(:,:,1) is the red channel, image1(:,:,2...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Finding the sum of the first n primes and to use a while function
There are two issues in your code: You are testing if i is not a prime number, when you actually want to test whether it is a p...

plus de 3 ans il y a | 0

Réponse apportée
MATLAB Figure and LATEX
I'm not sure what the issue is, but your figure displays just fine when I save it to a png file (my preferred graphics file form...

plus de 3 ans il y a | 0

Réponse apportée
Merging two arrays of two different types
You are combining double values (from a) with character values (from b), which yields a character array according to MATLAB's cl...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
How Can I Show a txt File in a GUI ?
A text area would be the way to go, as it will show a scroll bar and wrap text if the content of the textfile is larger than the...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Count if a vector has at list one element greater than zero
count = sum(v>0) The expression v>0 creates a logical array of 1s and 0s, with a 1 for every element of v that is greater than ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Equation in a single column matrix?
When I run your code (after fixing a typo when you refer to what I think should be b(n)/13), the result is a 1-by-6 array for c:...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
evaluation of anonymous function
I am not quite sure if this is what you are asking, but I'll give it a shot: The piece of code important to your question is r...

plus de 3 ans il y a | 1

Réponse apportée
Adding a pathdef.m file, as a string, to the current path
You probably want to use textscan for this: fileID = fopen('pathdef_etc.m') C = textscan(fileID, '%s', 'Delimiter', '\n') fcl...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
how to define a gradient colormap
Yes, you can use a fixed colormap by executing the following command each time you plot an image: caxis([-1 1]) This will map ...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Index a cell array with an cell
Hi Christian, You can pick the corresponding entries for each of the cells of C as follows: C{i}(B{i}==0) The results are the...

plus de 3 ans il y a | 0

A résolu


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

plus de 3 ans il y a

Réponse apportée
Delete values in a table but keep the cells
Try df{r,c} = {''} instead. You should be able to avoid the inner loop entirely by using df{r,3:nCols} = {''} Also, to check...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Specify annotation position with respect to x- and y-axes values?
This is an older post, but the following is perhaps useful to others: If horizontal arrows are ok, data units can be used by as...

plus de 3 ans il y a | 22

Réponse apportée
check if figure exists whithout making it appear and using its figure number in findobj()
R2014b and later no longer use numeric handles for graphics objects, so most answers given above do not work. In these cases, ...

environ 9 ans il y a | 1