Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 1

Respondida
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 ...

más de 13 años hace | 0

Respondida
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); ...

más de 13 años hace | 1

| aceptada

Respondida
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)))

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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 ...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 5

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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.

más de 13 años hace | 1

| aceptada

Respondida
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 ...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 1

| aceptada

Respondida
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) =...

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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 ...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 0

| aceptada

Respondida
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],[...

más de 13 años hace | 0

| aceptada

Problema


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...

más de 13 años hace | 2 | 14 solvers

Respondida
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...

más de 13 años hace | 0

Respondida
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-...

más de 13 años hace | 0

Respondida
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....

más de 13 años hace | 0

| aceptada

Respondida
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...

más de 13 años hace | 0

Respondida
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...

más de 13 años hace | 1

Cargar más