Réponse apportée
To set value based on condition in a matrix
Here is an example. % First make the matrix and get the needed numbers... A = zeros(ceil(rand(1,2)*10)+1); % The matri...

plus de 13 ans il y a | 0

Réponse apportée
Is this a Possible MATLAB bug? (Further strange Behavior)
According to the documentation, " _The MATLAB software creates the ans variable automatically when you specify no output argu...

plus de 13 ans il y a | 1

Réponse apportée
Using ' findobj ' command and then determining the figure objects from the list of handles
You can narrow your search to specific object types in only specific figure windows. findobj(1,'type','line') % Finds only ...

plus de 13 ans il y a | 0

Réponse apportée
how to avoid using num2cell when dealing to structure arrays?
There is a way to do it, and it will be faster (at least it is here): for ii = 1:length(b) a(idx(ii)).a = b(ii); ...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Summing within an array to change the size
Here is one way to do it: A = magic(6); cellfun(@(x) sum(x(:)),mat2cell(A,2*ones(1,3),2*ones(1,3)))

plus de 13 ans il y a | 0

Réponse apportée
how speed up or avoid loops
This is much faster. Note that you are masking a very valuable MATLAB function by naming a variable 'sum' in your loop! Please...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
how to throw out certain intervals.
Is this what you want? X = [ 2 3 4 57 36 2 ]; Y = X(X>10) I take it this is what you are after because of a loop you ...

plus de 13 ans il y a | 0

Réponse apportée
Using i and j as variables
Yes, I ran into much trouble in my early days of MATLAB using i and j as indices in signal processing and data manipulation code...

plus de 13 ans il y a | 5

| A accepté

Réponse apportée
How can I quickly refer to various object handles in my GUI?
Here is how I handle situations like these. I store all handles to a specific type in a structure with a fieldname correspondin...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Double Loop iterations doubt
Is this what you mean? if ~mod(i,12) j = j + 1; end I am assuming here that j is set outside the loop you sho...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Search and Compare Arrays
I assume the temperatures in B exactly match those in A? In other words, you are not interpolating. First the FOR loop you req...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Problem with markers & dashed lines in figures containing both plot and fill
This is a problem with the opengl renderer. When you have a transparency, you are using opengl, and it can be buggy. To see th...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Error: Not enough input argument (line 6)
The error is not in the function, but in the way you called it. You called it with no input arguments.

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
changing an image to rgb format
A png is already 3D. I have an image named IMG.png in my directory. Now look: >> X = imread('IMG.png'); >> whos ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Which solver to use? I cannot get an answer, though I know there is one.
Use: ROOT = solve(lhs-rhs,'L'); There are other roots. You might just want to use FZERO: fzero(@(x) subs(lhs,x...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Slider for Multiple Plots in GUIDE
Here is a simple example GUI. Note that the same principle applies in GUIDE. function [] = slider_plot() % Plot dif...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
Generate a matrix of 1 and 0
Is this what you mean: A =[4 5 3 2 4 2 1 4]; U = unique(A); B = zeros(max(U)); for ii = U B(A==ii,ii) =...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
GUI GUIDE Error with Map
You clear long and lat, then immediately try to use them. This is your error. You also rely on Poofing variables into your wor...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Accessing cell array via factor/index
I assume you mean that the each row in the third column contains one of 'fs','pre','sv',or 'to', not all 4! This snippet finds ...

plus de 13 ans il y a | 0

Réponse apportée
how to write a loop
Instead of using: for i=1 use if i==1 (And it is generally not recommended to mask MATLAB functions in your co...

plus de 13 ans il y a | 0

Réponse apportée
How can I forecast an integer related to other 5 numbers?
Here is another way that uses no toolbox. Find the weights.... % First the data. D = [33 48 47 68 79 6; 26 32 3...

plus de 13 ans il y a | 0

Réponse apportée
How to ignore values in a matrix that is out of bound when performing column 'find' in an array?
Z = max(Z,0)

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
Why does dir('*.mat') not list all of the .mat files in directory?
Are you sure about those files being in there? Does WHAT see them (type: what) in there? D = dir; length(regexp([D(:).n...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How can I fill a plot section from a single x,y coordinates?
I would fill it with a patch object. line([1 1],[0 100],'color','b','linewidth',3); hold all verts = [[0;1;1;0],[...

plus de 13 ans il y a | 0

| A accepté

Problème


Find the repeating decimal pattern!
Write a function that takes one double input value and returns only the repeating decimal, if any, as a string. Only decimals f...

plus de 13 ans il y a | 2 | 14 solveurs

Réponse apportée
while loop; a small problem
This loop, as you written it, should always 'get stuck' because k does not change inside the loop. What are you trying to do wi...

plus de 13 ans il y a | 0

Réponse apportée
How can I get the index of the selected item in a pop-up menu within a uitable?
I don't see how to do this. The best I can suggest to you is to use <http://www.mathworks.com/matlabcentral/fileexchange/14317-...

plus de 13 ans il y a | 0

Réponse apportée
Converting rad to deg in a static text box GUI?
The problem is that you are passing ANGLEDIM a string and expecting a string output. It takes and returns doubles, not strings....

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
How do I correct this plot code?
Whenever you mean to multiply (or divide) a vector by a vector on an element-by-element basis, you must use the (.*) or (./) ope...

plus de 13 ans il y a | 0

Réponse apportée
Can interp1 function be used when the time interval of data isn't uniform?
When I have a question like this, I just do a little experiment. x = sort(rand(1,30)*2*pi); % Non-uniform data y = sin...

plus de 13 ans il y a | 1

Charger plus