Answered
Repeated Printing of output of function
_"why do I get the output for vegaCall twice?"_ You don't. They are actually two different things being printed. *Solution...

10 years ago | 1

Answered
stop running script after close figure
Hint: get the figure handle, and check it with <http://www.mathworks.com/help/matlab/ref/ishghandle.html |ishghandle|>. This is ...

10 years ago | 0

| accepted

Answered
for loop number in to cell
This is MATLAB... why waste time using a loop? cellstr(strjust(num2str((-5:5).'),'left')) or arrayfun(@num2str,-5:5,...

10 years ago | 0

| accepted

Answered
Can someone do this calculation without for loops?
tmp = bsxfun(@times,a,reshape(c,1,1,1,[])); tmp = bsxfun(@times,a,exp(tmp)); tmp = bsxfun(@times,reshape(b,1,1,[]),tmp);...

10 years ago | 0

| accepted

Answered
matlab error Too many outputs requested. Most likely cause is missing [] around left hand side that has a comma separated list expansion
When |t==iii| has two or more true values, then this code hcell{(t==iii)} returns multiple values in a <http://www.mathw...

10 years ago | 0

Answered
Make discontinuous data continuous
>> xi = [0,450,1200,5000,9000,14000,20000]; >> yi = [-23,6,-1,8,-8,1,-20]; >> xo = linspace(xi(1),xi(end),256); >> yo...

10 years ago | 0

Answered
How to assign a variable value as structure name?
Use a <http://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscalar-struct-array.html non-scalar str...

10 years ago | 0

Answered
How to add data into a matrix already declared without overwriting the previous values?
>> P = [1,2]; >> P(end+1,:) = [1,2.5] P = 1.0000 2.0000 1.0000 2.5000 Or >> P = [1,2]; >> P = [P;1,2.5...

10 years ago | 0

| accepted

Answered
How to find line of code that prints ans
Method one The MATLAB editor already identifies (most of) these lines for you! This is one of the many helpful features that t...

10 years ago | 1

Answered
Count the occurrences of each element in a vector in MATLAB?
The output syntax that you asked for is not MATLAB syntax, and does not really make sense for MATLAB. Here is one easy way to ge...

10 years ago | 1

Answered
Automate the opening of .mat files and the aggregation of opened matricies
My code correctly <http://www.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html preallocates> the output matrix, a...

10 years ago | 1

| accepted

Answered
How to read multiple files from one from folder /dir
As the <http://www.mathworks.com/help/matlab/ref/uigetfile.html |uigetfile|> documentation clearly states, _"If 'MultiSelect' is...

10 years ago | 0

Answered
MATLAB GUI: Using the output of one callback as the input for another callback
This is the comprehensive guide: <http://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html> <htt...

10 years ago | 1

Answered
Reading lines from a .raw file and storing them into an array
fid = fopen('temp.txt','rt'); hdr = regexp(fgets(fid),',','split'); fmt = repmat('%s',1,numel(hdr)); C = textscan(fid...

10 years ago | 0

| accepted

Answered
How do I ask for a workspace variable input in a running program?
Put all of your variables into a <http://www.mathworks.com/help/matlab/structures.html structure>. Then you can simply do this: ...

10 years ago | 1

Answered
array name indexing in matlab
https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval

10 years ago | 1

Answered
Increasing number in an array by an order of magnitude
>> logspace(-1,2,4) ans = 0.1 1 10 100

10 years ago | 0

Answered
Save a vector from a loop 0:1
Simply put those values in a vector, and iterate over the indices of that vector: vec = 0:0.1:1; y1real = NaN(size(vec))...

10 years ago | 0

Answered
Converting to numerical ordering from ASCII ordering
The order returned by dir is not specified by its documentation. This means you need to sort its output data yourself. There is...

10 years ago | 0

Answered
converting array to single
If the elements of the cell array are numeric scalars: >> C = {1,3,8,6,3,6,4,4,9,6,8}; >> sprintf('%d',C{:}) ans = 13...

10 years ago | 1

| accepted

Answered
Using vectors as the start and end of indices
If you want to be able to input any |start| and |finish| vectors: >> start = [1, 22, 40]; >> finish = [10, 30, 48]; >...

10 years ago | 2

| accepted

Answered
Not sure why "eval(name of a variable)" cannot be assigned a value
This is why beginners love |eval|: because they think it solves problems. In reality it just makes problems that are hard to deb...

10 years ago | 2

| accepted

Answered
Strcat multiple cell arrays not outputing expected output
*Explanation* |strcat| concatenates strings. However |num2cell([1:100]')| are not strings, they are numeric scalars in a cell...

10 years ago | 0

| accepted

Answered
Create a MATLAB program that creates other programs?
Here is one solution. Define two files: # Write a "template" Mfile, which is complete except for that line. On that line put ...

10 years ago | 0

| accepted

Answered
How can I access structures through strings?
You just need to use parentheses: S.(fieldname) <http://www.mathworks.com/help/matlab/matlab_prog/generate-field-names-fr...

10 years ago | 12

| accepted

Answered
Continue a statement into many lines without using ' ' ...
*Short answer:* no Don't write it by hand anyway: for string that long it should be stored in a text file and read it into...

10 years ago | 0

Answered
how define colormap for range of value of z data
That is not how colormaps work. In MATLAB colormaps are just a list (a matrix) of colors, they do not include any mapping inform...

10 years ago | 0

Answered
How to access and change variables in workspace without knowing their names?
Do NOT do this This would actually be horribly slow, pointlessly complex, obfuscated, and very buggy way to write your code. Yo...

10 years ago | 2

Answered
how to write this equation
I used |y| and |B| to make it easier to read: num = 2*y*(r^((y-1)/y)-1) den = (y-1)*(B^4 - r^(-2/y)) out = sqrt(num/d...

10 years ago | 0

| accepted

Load more