Answered
Merging array into matrix of unequal size
_"I find it a bit tedious and messy and hope to hear if there is a cleaner solution out there"_ I doubt it. Sometimes code is...

8 years ago | 1

Answered
How to generate function handle automatically from the cell array?
@ashadako: you have since edited your question and completely changed the function specification. This answer give the original ...

8 years ago | 1

| accepted

Answered
Matlab GUI doesn't recognize cell array in the handles structure
Instead of handles.finishCell = finishCell{k}; you need handles.finishCell = finishCell(k); A cell array is a c...

8 years ago | 0

| accepted

Answered
Preallocating cell array concent
Simple: data = cell(1,8) data(1:8) = {NaN(3,5)} How does this work? Compare to your numeric example: test(1:8) =...

8 years ago | 5

Answered
How to efficiently save variables from an app
There is no easy way to do this using |uisave|, because it requires the variable names and not the names of fields of a structur...

8 years ago | 2

Answered
How to define a row delimiter?
Use <https://www.mathworks.com/help/matlab/ref/textscan.html |textscan|> and set the |Delimiter| and |EndOfLine| options, e.g.: ...

8 years ago | 0

| accepted

Answered
1. xlsread import data only upto 4 decimals whereas i need data upto 12 decimals
1. You actually answered your own question, without knowing it: _"While import using xlsread it is *showing* the value..."_ H...

8 years ago | 1

| accepted

Answered
how can i solve this 'Undefined function or variable '?'.
The problem is simple: |remainder_8| does not exist, because your code never defines it. Think about what happens when all of th...

8 years ago | 0

Answered
Problem adding headers to a matrix and saving it in txt file
<https://www.mathworks.com/help/matlab/ref/dlmwrite.html |dlmwrite|> only writes numeric data: its help states that it _"writes ...

8 years ago | 0

| accepted

Answered
change the structure of cell
A = A';

8 years ago | 0

| accepted

Answered
divide matrix to be sub-matrix
*Method one: <https://www.mathworks.com/help/matlab/ref/mat2cell.html |mat2cell|>:* mat2cell(A,[3,3,3,2]) You can genera...

8 years ago | 0

| accepted

Answered
How to go through permutations without storing all of them?
<https://www.mathworks.com/matlabcentral/fileexchange/22692-nextperm> <https://de.mathworks.com/matlabcentral/fileexchange/44...

8 years ago | 0

| accepted

Answered
Simple Use of Strings
Your version of MATLAB does not support the string class. _"String arrays were introduced in R2016b"_: source: <https://ww...

8 years ago | 0

| accepted

Answered
How to looping to generate small segmental arrays and appending them?
You do not describe exactly what the required output should be, but it would probably be simpler to do this using some basic arr...

8 years ago | 0

| accepted

Answered
Column vector multiplied to a row vector, memory v.s. speed issue
Loop over |A|, it won't take very long as long as long as the output is <https://www.mathworks.com/help/matlab/matlab_prog/preal...

8 years ago | 0

| accepted

Answered
Keep leading zeros on import from excel?
Have a look at the other outputs, one of them might do what you want: [num,txt,raw] = xlsread(..)

8 years ago | 0

Answered
How can I number instances of a value in an array?
Download <https://www.mathworks.com/matlabcentral/fileexchange/56131-runindex-a--c- |runindex|> from FEX: >> str = 'aaabbcc...

8 years ago | 2

| accepted

Answered
save the loop data in a if else statement
It is simpler to avoid generating too many values (and then using |mod| to select which values you want to use) because then you...

8 years ago | 1

Answered
I have a function which plot a certain graph. How should I code this so that the function will not deliberately plot in a figure but in the axes of the gui instead?
You need to tell that plotting command which axes to use, by providing the axes handle. How to do this depends on the plotting c...

8 years ago | 0

| accepted

Answered
How to delete 'NA' columns from a text file?
This is easy with <https://www.mathworks.com/help/matlab/ref/textscan.html |textscan|>, <https://www.mathworks.com/help/matlab/r...

8 years ago | 0

| accepted

Answered
Merge 8000+ csv files into one
Best practice would mean that you should: * <https://www.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html prea...

8 years ago | 1

Answered
How do i create a program that, depending on the input value would create more or less variables
Forget about dynamically accessing variable names, simply vectorize your code and you will immediately be on the way to writing ...

8 years ago | 0

| accepted

Answered
Creating a variable referencing specific cells from a cell variable with 30 structures?
Assuming that by "structure" you really just mean "array", and |C| is your cell array, then this might work for you: tmp = ...

8 years ago | 0

Answered
How to: map selected entries of one matrix to entries of a second?
Remove the NaN values, then use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: isn = isnan(Row_map) | ...

8 years ago | 1

| accepted

Answered
How to find multiple numbers in a matrix
The most generalized solution is to use |ismember|: >> A = [1,2,3,3,5,6;7,8,3,3,5,12;13,14,3,3,17,5]; >> b = ismember(A,...

8 years ago | 0

| accepted

Answered
Error: File: gsp_opt.m Line: 6 Column: 17 Unexpected MATLAB expression. ?
costfunction = @(x) mycost(model,x); ^ ^ you need these! See: <https://www.mathworks.com/help/matlab/mat...

8 years ago | 0

| accepted

Answered
Output argument "h" (and maybe others) not assigned during call to "entf"?
There are multiple ways that |h| might not be defined, because your logic does not cover all values. For example: * n=2 and T...

8 years ago | 0

| accepted

Answered
what is the purpose of %20s\n?
According to the <https://www.mathworks.com/help/matlab/ref/fprintf.html |fprintf|> documentation (which you can also read): ...

8 years ago | 0

| accepted

Answered
Combination of multiple arrays
Faster, much simpler code, uses less memory, creates only one intermediate variable (a scalar value), and works regardless of wh...

8 years ago | 2

Load more