Réponse apportée
I'm having problems running input functions in matlab, does anyone know why?
There is nothing wrong with your use of INPUT, so something else is going on. Tell us the name of the script, and show how you ...

plus de 13 ans il y a | 0

Réponse apportée
Can anyone show me how I can avoid following for loops
Here is a one approach: M = diag(repmat([1 4],1,1000)) +... diag([repmat([2 0],1,999) 2],1) +... diag(...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How do I find the zeros of my function?
Here is a simpler approach: x = (-2:0.01:2); y = @(x) 2*x.^4-3*x.^2+x-7; plot(x,y(x)); hold on; cnt = 1; f...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
How can I can I trigger the callback of an edit text control when setting its value from within the callback of a slider control?
Editbox callbacks execute when you hit return with the cursor in the text field. You can also just set the string from the slid...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
how can I generate a random matrix?
You will of course have to make sure that x==m*n, as you describe it. f = @(x,m,n) reshape(randperm(x),m,n); f(20,5,4)...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Is there anything wrong to my code?
I don't think you have told the whole story: >> N = '9A'; >> b1='9'; >> (((N(end)=='A' || ... N(end)=='B' |...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Finding rows in a matrix
Another: % The given matrix A = [1 2; 2 1; 1 2; 2 2; 1 1; 2 2]; % Now find the counts. [I,J,K] = unique(sort(A,2...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
changing part of the name of a variable inside a "for" loop
Do not program this way! The use of eval is *slow*, *hard to read*, *difficult to process*, works without taking advantage of *...

plus de 13 ans il y a | 4

| A accepté

Réponse apportée
Removing specific characters in a string?
str = 'The quick brown fox jumped over the lazy dog'; strn = regexprep(str,'[tixy]','')

plus de 13 ans il y a | 4

| A accepté

Réponse apportée
How can I add a char in a matrix?
A = sprintf('%i',1:5); % Make a character array. A(6) = 'B' If you must have spaces, then you must be more careful abou...

plus de 13 ans il y a | 0

Réponse apportée
how can I stick together the data in a matrix?
A = 1:5 B = str2double(sprintf('%i',A))

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
question about multi variable data fitting
Give this a try: g=fittype('a*exp(-(x-b).^2/c.^2-(y-d).^2./f^2)','inde',{'x' 'y'},'dep','z'); or, use a function handle:...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
removing parentheses around digits using regular expressions
regexprep(str,'(\()([\d*\.]+)(\))','$2')

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
How do we sort one column of an alpha-numeric table and make the other columns to adjust accordingly?
When I import as you explain, I get this: A = [10x1 double] [10x1 double] {10x1 cell} So if your A doe...

plus de 13 ans il y a | 2

| A accepté

Réponse apportée
what is subplot and how to use it?
figure subplot(1,2,1) plot(1:10) subplot(1,2,2) plot((1:10).^2) help subplot

plus de 13 ans il y a | 1

Réponse apportée
Problem in using 'break' and 'while'
This will prove to you that the break statement *does* work: x= rand(); a=0; s=0; while 1 % Infinite loop...

plus de 13 ans il y a | 1

Réponse apportée
How to concatenate data points
I am a little uncertain that this is what you want. But just to get started is this solving the actual problem? A = ...

plus de 13 ans il y a | 0

Réponse apportée
using fzero to find root of nonlinear equation
To highlight what Matt J said in a comment, you have a problem with your function definition: F = @(x) x.^q2*(r+p-r.*q1...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
MOD bug? Or something else?
Floating point arithmetic.... Look closely at the numbers. x = [-2:.2:2]; fprintf('%16.16f\n',x) You can read more ab...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Accessing certain Dimension of Multidimensional Array
Here is how I would do it: % A is given, up to 8 dims here. A = rand(max(2,randi(4,1,max(3,randi(8))))); idx1 =...

plus de 13 ans il y a | 4

| A accepté

Réponse apportée
Error message: "undefined function for input arguments of type 'logical' "
It indicates that there is no function by the name that you called for inputs of the logical type. So either you called a funct...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How to identify a window created by system command
What do you mean, "move it into my GUI window"? You cannot have a figure be a child of another figure, if that is what you are ...

plus de 13 ans il y a | 0

Réponse apportée
terminating a script with a quit comand
Since the SWITCH is in the loop, why not just set choose to 10 if the user wants to quit? Then the loop condition will fail and...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How to use Floor command
You have fallen into thinking that you are using infinite precision arithmetic when you are only using double precision. This i...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Avoid for loops with if inside
Just taking this outside all loops will *GREATLY* speed it up. g = fit(x',y','splineinterp'); Beyond that, you could...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Coeffs of non linear product terms
I think a FOR loop would be fast enough here, but.... syms x y [c, v] = coeffs(x+y+2*x*y,[x,y]); C = arrayfun(@ch...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Problem with ASCII characters in MATLAB
From the doc: "char(X) converts array X of nonnegative integer codes into a character array. Codes *from 0 to 127* correspo...

plus de 13 ans il y a | 1

Réponse apportée
How to Insert desired rows from one matrix into a new one
v = [2 0 0;1 0 1;4 5 6;-1 1 2; 2 3 4] % Sample array. P = v(sum(v,2)==2,:)

plus de 13 ans il y a | 0

Réponse apportée
I need an example of a defined function in M-files
# From the command line, type this: edit # Copy the code below. # Paste it into the blank window that opened from step 1. ...

plus de 13 ans il y a | 1

Réponse apportée
Error: Function definitions are not permitted at the prompt or in scripts.
Don't try to define a function at the prompt or in a script. Put functions in their own M-files.

plus de 13 ans il y a | 1

| A accepté

Charger plus