Answered
How to convert a cell array of different size to matrix of fixed size
nCol = cellfun('size', A, 1); nRow = numel(A) * 2; Output = NaN(max(nCol), nRow); But I guess you want to insert ...

8 years ago | 2

| accepted

Answered
How vectorize this operation
The code works vectorized already. So the problem is not vectorizing. The code can be simplified slightly: M = x .* L; ...

8 years ago | 0

Answered
How to Change a Value of parameter in GUI and automatically change in script file.
function PU = testfun H = figure; uicontrol('Style',... 'pushbutton',... 'String',' 1 ',... ...

8 years ago | 0

| accepted

Answered
Counting occurrences of each column in a matrix
Maybe: A = [1 .6 .7 .8; ... 0 .4 .3 .2; ... 1 .6 .7 .8; ... 1 .6 .3 .8]; Count = sum(A == A(1, ...

8 years ago | 1

Answered
How to replace ode45 with Eulers method?
I recommend to ask an internet search engine for "Matlab euler method". You will find e.g.: * <https://www.mathworks.com/matl...

8 years ago | 1

Answered
How to print a certain amount of elements in an array?
I'm not sure, what you are asking for, but a bold try: Info = [52211 3.55; ... 52922 1.79; 51939 3.33...

8 years ago | 1

Answered
Saving data using uiputfile using user defined path
Either: [fileName, pathName] = uiputfile('Coefficients.h'); [fileName2, pathName2] = uiputfile('parameters.h', 'Choose...

8 years ago | 1

Answered
Extracting numbers from mixed string
s = '2001_06m'; d = sscanf(s, '%d_%d') ans = 2001 6 Easier and faster than |regexp|. *[EDIT...

8 years ago | 2

| accepted

Answered
why evalin('caller', 'evalin(''caller'', ''a'')') works in a stack of script. but not a stack of functions?
While using functions is surely the best answer, the actual question concerned scripts. Then you do not have to call |evalin| at...

8 years ago | 0

| accepted

Answered
Why doesn't the script work on my pc but it works in anothers in the exact same conditions?
If the code works on one computer, but not on the other, this is a proof, that the conditions are not identical. We cannot know,...

8 years ago | 1

Answered
How to replace matrix value with string from cell array?
output = sprintfc('%.4f', data); index = strncmp(c, '#', 1); output(index) = c(index);

8 years ago | 1

| accepted

Answered
can I use variable to access different structures
Instead of defining labels, you can store the variables in an array: data = {alum, piezo}; % E.g. a cell array for n=1:...

8 years ago | 0

| accepted

Answered
Split a sampled dataset into trials
Do not hide indices in the names of variables line in "trial1". See <http://www.mathworks.com/matlabcentral/answers/304528-tutor...

8 years ago | 0

| accepted

Answered
MATLAB 2017b: Access violation error. I run my program in loop but always terminates after few hours at a specified time in
It looks like a crash in perhaps an IO function. I'd recommend to follow this advice from the bottom of the text: If this ...

8 years ago | 0

Answered
Activity list is not updating
Yes. The activities are updated after a certain delay. I did not check the mail notifications in the forum, but the notification...

8 years ago | 2

| accepted

Answered
how to find cityblock distance?
|pdist| and |pdist2| can calculate the city block distance.

8 years ago | 0

Answered
Why are my vectors different lengths?
L=1*y; %Number of samples No. 1*y is the same as y. You did not show how y is defined, by I guess that you want...

8 years ago | 0

Answered
Out of memory error while using for loop
"gives memory error" might mean, that you are running out of memory. If X1{i} is e.g. a 6691240x1 vector, |size(X1{i})| replies ...

8 years ago | 0

Answered
How to get program to keep asking for the input until the user provides a correct one?
ready = false; while ~ready x = input('Enter a number between 100 and 200:'); ready = (x>=100 && x<=200); if...

8 years ago | 1

Answered
using dir() to get timestamp of file with ms precision
Under Windows you can use the C-Mex functions <https://www.mathworks.com/matlabcentral/fileexchange/24671-filetime FEX: Filetime...

8 years ago | 0

Answered
Converting a for loop to a while loop
The problem is, that |i| has not been initialized before the |while| loop. Then |i| is defined as |sqrt(-1)|. See madhan ravi's ...

8 years ago | 0

Answered
Replace several functions with a one "master" function
What about: funcList = {@(t,x) (x + 1); ... @(t,x) x * ( x + 1); ... @(t,x) 2/x * (x + 1); .....

8 years ago | 0

Answered
how to split a member of cell array
% Create some input data for testing ("InCell" is your input): InCell = cell(100, 1); for k = 1:100 InCell{k} = ran...

8 years ago | 0

| accepted

Answered
suppose I have a matrix of order 5x5 named A. What will we get if we use A(:,:,1) and A(:1:)?
Trailing singelton dimensions are ignored in Matlab for more than 2 dimension, so |A(:, :, 1)| is exactly the same as |A(:, :)| ...

8 years ago | 1

Answered
Is it possible to make combvec function faster
You can inline the code of |combvec|: X = rand(310, 5, 5); Y = rand(1, 5); sX = size(X, 2); for i = 1:size(X, 3)...

8 years ago | 1

| accepted

Answered
passing a GUI handle to a function that is giving me error when I try to use get to get the value of a checkbox in that GUI
This is a strange definition: function readAndWriteMessages(src,~,h,~,~,~,~,~,~,~,~) Why providing 11 inputs, when you i...

8 years ago | 0

Answered
is it possible to replace for loops to fast it up?
Start the optimization of the code by using the profiler to determine the bottleneck. It is a waste of time to improve a piece o...

8 years ago | 0

Answered
When you first start MATLAB you need to log in to the system with your credentials, when I enter e-mail and password, it gives an "invalid security token" error.
If you ask an internet search engine for this problem or search in this forum, you will find: * <https://www.mathworks.com/ma...

8 years ago | 0

Answered
when i write the code contfrac for computing continued fraction for example contfrac(pi,3) it appear this note "Undefined function or variable 'contfrac'" why?
|contfrac| is a MuPAD function. Did you install the required toolbox?

8 years ago | 0

| accepted

Answered
Clear all returns warning evaluatecode.m could not be cleared because it contains the code that is currently executing?
I don't use clear all to clear workspace variables. I only use it at the beginning of the main method. This is a contradic...

8 years ago | 0

| accepted

Load more