Answered
How to set default value of a slider in GUI?
Try using this _minimum working example_, which includes a text box and a slider that updates its value: function main %...

10 years ago | 1

Answered
I have MATLAB version R2011b and I cant run a simple function like y=x^2 because of error "Error using test (line 2) Not enough input arguments."
Don't click the green "Run" button: this button calls the function without any input arguments, thus the error. Call your functi...

10 years ago | 1

| accepted

Answered
Find value of second dependent variable corresponding to new value of independent variable based on defined array
This is exactly what <http://www.mathworks.com/help/matlab/ref/interp1.html |interp1|> does: X = normrnd(0,1,10,1) Y = 1...

10 years ago | 0

| accepted

Answered
How to find the value of a matrix in a specific position?
You can use <http://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: idx = sub2ind(size(B), A(:,1), A(:,2)); out...

10 years ago | 0

Answered
How to convert a matlab figure to a latex code? (no graphic export)
Download this FEX submission: <https://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz> You wil...

10 years ago | 2

Answered
How can I create a new matrix following some conditions
>> X = bsxfun(@ge,B(:,1),A(1:end-1,1).') & bsxfun(@le,B(:,1),A(2:end-0,1).'); >> out = sum(bsxfun(@times,X,B(:,2)),1) ./ su...

10 years ago | 1

| accepted

Answered
Default decimal seperator comma instead of dot
*Short answer:* no. *Long answer:* maybe, if you are prepared to play around with Java: <http://undocumentedmatlab.com/blo...

10 years ago | 1

Answered
Find following values and represent them in a matrix
A = [23,34,45,0,0,0;21,34,0,0,23,11;34,23,0,0,0,22;23,11,21,0,0,45;11,45,23,0,0,0]; [R,C] = ndgrid(unique(A(A~=0))); fun...

10 years ago | 1

| accepted

Answered
Array using for loop: using sprintf
You could use a loop like this: # define the two vectors, say |X| and |Y|. # loop over them, using |for k = 1:numel(X)|. # ...

10 years ago | 0

| accepted

Answered
problem with filling roseplot - truncated colours
It works for me (MATLAB 2012b): rdir = [270,190,100,250,270,330,250,30,300,310,180,250,350,310,250,260,250,350,290,220,340,...

10 years ago | 0

| accepted

Answered
Problem with structure in image processing
You need to use a colon, not a comma: for i = 1:numel(imglist)

10 years ago | 0

| accepted

Answered
Find Matrix Elements That Meet a Condition
Although there are many ways of doing this, here are two robust methods. Note that using a loop might seem attractive to beginne...

10 years ago | 1

Answered
Needs help in uploading only the needed file to the user interface
This is easy: simply tell <http://www.mathworks.com/help/matlab/ref/uigetfile.html |uigetfile|> exactly which filenames you want...

10 years ago | 1

| accepted

Answered
Vector to Matrix Conversion
_"is there a more efficient way to do this?"_ Probably <http://www.mathworks.com/help/matlab/ref/reshape.html |reshape|> does...

10 years ago | 0

Answered
How to split and save .txt columns using for loop
Ugh... this is a *really bad idea*! Avoid creating dynamically named variables in MATLAB. This is *poor practice* as has been...

10 years ago | 1

| accepted

Answered
How to save workfile without graphics
If you don't want to save everything in your workspace, then don't save everything in your workspace. It really is that simple. ...

10 years ago | 1

| accepted

Answered
How to combine two or more than two matrix
you could use Jos' excellent FEX submssion <https://www.mathworks.com/matlabcentral/fileexchange/10064-allcomb-varargin |allcomb...

10 years ago | 1

| accepted

Answered
Creating vector of real numbers and use it in another function
Instead of laboriously writing out every number, why not get the computer to create that vector using the <http://www.mathworks....

10 years ago | 1

| accepted

Answered
Loading .mat file from within GUI not doing anything?!
There is no such thing as _" *the* workspace"_... you might be thinking of the *base workspace* when you say that, but in fact e...

10 years ago | 2

| accepted

Answered
array fetching and placing in matrix
*Edit* works for input matrices of any size: % input data: p = [12,10,11,13,8,9,5]; c = zeros(3,3); % input sizes:...

10 years ago | 0

| accepted

Answered
Hi everyone, can you help me to solve following program
>> A = [1,2,3;4,5,6;7,8,9]; >> B = 2*ones(3); >> C = [A;B]; >> C = reshape(C(1:end-3),[],3) C = 1 2 2 ...

10 years ago | 1

| accepted

Answered
How to save to different column array
>> M = [... 1, 3,NaN, 5 2,NaN,NaN,NaN 5,NaN,NaN,NaN 6,NaN,NaN, 8]; >> out = M(:,any(isfinite...

10 years ago | 0

Answered
My rectangle should have a determined color represented by a value
The easiest way is to use <http://www.mathworks.com/help/matlab/ref/caxis.html |caxis|>, like this: V = [0,0;1,0;1,1;0,1;5,...

10 years ago | 1

| accepted

Answered
simple coding, how to write (x-1)...(x-n)
The simplest solution, without any loops: prod(x-z)

10 years ago | 0

Answered
How to Normalize a matrix between 0-1 containing NaNs?
Ignoring infinity: S = load('A.mat'); A = S.A; idx = isfinite(A); Amax = max(A(idx)); Amin = min(A(idx)); B ...

10 years ago | 0

Answered
How to make matrix?
How to create matrices and arrays is explained in the MATLAB documentation: <http://www.mathworks.com/help/matlab/elementary-...

10 years ago | 0

Answered
How can i make a specific program with structure 'for'?
>> sum(sscanf(input('Enter a vector: ','s'),'%f%*[, ]')) Enter a vector: 1,2,2,4 ans = 9 >> sum(sscanf(input(...

10 years ago | 0

Answered
Advantages and workarounds for using a main function for a project?
In general _code_ and _data_ should be thought of as two different things. While for small tasks, or where the values really are...

10 years ago | 0

| accepted

Answered
MATLAB poems -- let's hear 'em!
Not quite a poem... With my apologies to the great bard, from "Antony and Cleopatra": * LEPIDUS: What manner o' thing is your...

10 years ago | 4

Answered
Using dir to locate multiple file names and xslread to load them
Try something like this (untested): stP = 'C:\Users\name\Documents\MATLAB\Accel 7'; stN = 'Flex*.xls'; S = dir(fullfi...

10 years ago | 1

| accepted

Load more