Answered
Questions on errors in GUIDE
|handles.storedvals| is a cell array of the data in the uitable, therefore you need cell array indexing to access its contents: ...

9 years ago | 0

| accepted

Answered
Importing 200 excel files in the correct order
Download and use my FEX submission natsortfiles, which provides an alpha-numeric sort of filenames: https://www.mathworks.com/m...

9 years ago | 1

| accepted

Answered
Concatenating array using for loop
A loop is not required: tmp = Cure.neat; A = [tmp(1:9).temps]; <https://www.mathworks.com/help/matlab/matlab_prog/com...

9 years ago | 0

Answered
how to print a matrix as ranked sorted list?
V = [56,9,8,7,4,5,6,3,35,4]; fprintf('Rank Score\n') fprintf('%4d %.2f\n',[1:numel(V);sort(V,'descend')])

9 years ago | 0

Answered
How can I save ALL workspace variables?
The simplest answer is *don't*. Instead <https://www.mathworks.com/help/matlab/ref/load.html |load|> into a variable (which i...

9 years ago | 0

Answered
How to find which postions in a vector has negative values and output them?
|find| is not required, logical indexing is simpler and more efficient: B = A(A<0)

9 years ago | 0

Answered
Load a variable from base workspace into a edittext field
Define the function so that |FileName| is an input argument: function DataCollector(FileName) ... app.EditField.Value...

9 years ago | 0

Answered
Map an array yo another one
Use <https://www.mathworks.com/help/matlab/ref/interp1.html |interp1|>: >> A = [3,5,6,10]; >> B = [1,2,3,4]; >> inter...

9 years ago | 0

Answered
How can I tell if this is stored as a vector?
"Displaying" in this context typically means to print some data to the command window. There are several ways to achieve this, s...

9 years ago | 0

Answered
How to put a vector in a file?
[fid,msg] = fopen('filename.txt','wt'); assert(fid>=3,msg) fprintf(fid,'%d\n',1:744) fclose(fid); Or V = 1:74...

9 years ago | 2

| accepted

Answered
vectorize a function that calls the itterator (condition in a loop)
Simplest: A = img>=minthreshold & img<=maxthreshold If you really wanted to, you could use indexing: A = zeros(sz);...

9 years ago | 1

| accepted

Answered
Avoid overwriting value of variable
Use indexing: Source_files = [specified directory] N = numel(Source_files); C = cell(1,N); for k = 1:N [sta...

9 years ago | 0

| accepted

Answered
How does bsxfun actually work ?
_"Can someone explain what exactly "singleton expansion" means and how is it used in this function?"_ |bsxfun| (and many oper...

9 years ago | 2

| accepted

Answered
Relative path gives wrong path
_"Still, I don't understand what it means to add the folder to the path"_ Like many programming languages MATLAB has a path w...

9 years ago | 0

Answered
How do I produce all the odd numbers of the form 3x + 1 for any integer x in the interval [100, 1000].
Without throwing any data away: 301:6:3001 Or, a bit more explicitly: 3*100+1:3*2:3*1000+1

9 years ago | 0

Answered
How am I misunderstanding this if statement?
_"Can anyone explain why this is?"_ It is simple: <https://www.mathworks.com/help/matlab/ref/if.html |if|> requires *all* of ...

9 years ago | 1

Answered
Why, when I pass a structure S into a function, and assign or update more fields to it, does it remove the fields it had when entering the function?
In your question you show that you pass the structure as an input to the function: S = function_name(S); But in your min...

9 years ago | 1

| accepted

Answered
Sort all columns in a cell array with labels
If you do not want to use a table then you would be better off keeping your numeric and cell-of-character data separately, e.g.:...

9 years ago | 0

| accepted

Answered
writing a matrix into a .txt file
You do not specify what kind of matrix you have, so I will assume that it is a <https://www.mathworks.com/help/matlab/cell-array...

9 years ago | 0

| accepted

Answered
Is it possible to run sections of a script with local functions?
_"However, when I try to run the last section, which calls the local function, and *includes the local function*, I get the erro...

9 years ago | 1

Answered
Can we do something like this similar to union()?
*Method one: |unique|, |arrayfun|, |ones|:* >> A = [2,3,3,5]; >> B = [1,3,5]; >> fun = @(n)n*ones(1,max(nnz(A==n),nnz...

9 years ago | 0

| accepted

Answered
How I do the following in a loop to save lines in a code in Matlab
It would be more reliable to <https://www.mathworks.com/help/matlab/ref/load.html |load|> into a <https://www.mathworks.com/help...

9 years ago | 0

Answered
fopen can not find/write to file
You are concatenating everything together (including the path), which means that |fullfile| does nothing at all. Only concatenat...

9 years ago | 0

| accepted

Answered
Write pre-existing variable names and their values to excel
<https://www.mathworks.com/help/matlab/ref/load.html |load|> the data into a variable (as the |load| documentation states, it is...

9 years ago | 2

| accepted

Answered
check the row that has at least one non zero element, except one row
idx = setdiff(1:r, row) any(matrix(idx,:),2)

9 years ago | 0

Answered
Shifting letters by two positions. What's wrong with the code?
Your basic mistake is that you assumed that the <https://en.wikipedia.org/wiki/ASCII#Printable_characters character code> for |'...

9 years ago | 1

| accepted

Answered
When I try to get a prompt to show a variable in it, it shows a random symbol instead?
pmt = sprintf(Please choose a day from 1 to %d\n',c); day = str2double(input(pmt,'s')) You assumed that by concatenating...

9 years ago | 1

| accepted

Answered
accepting values into an array, then accepting new values by shifting left
function outVec = fn_updateArray(newValue) persistent newVec; newVec = [newVec(max(1,end-5):end),newValue]; outVec = ...

9 years ago | 0

Answered
how to get all the variables from a struct
Download and use Matt J's handy function for generating all of those variables automatically: <https://www.mathworks.com/matl...

9 years ago | 0

| accepted

Answered
How do I Import multiple data files?
MATLAB is case sensitive: you define this variable: fileName = sprintf(...) but then try to call a different variable: ...

9 years ago | 0

Load more