Answered
Get error message of 'Error using max Invalid data type. First argument must be numeric or logical' when I attempt to apply max function to a column of data
Your data has class _table_. Tables are a _container_ class: they _contain_ data of other classes: <https://www.mathworks.com...

8 years ago | 2

| accepted

Answered
interesting matrix indexing question without for loops
Use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|> to get the <https://www.mathworks.com/help/matlab/math/ar...

8 years ago | 1

| accepted

Answered
Changing input name to save data from zip files into a data cell?
"Is there any way to right a loop that will change the name of the input??" Of course, just follow the advice in the MATLAB doc...

8 years ago | 0

Answered
Using regular expression to read part of the filename
>> str = '5_20180927_161742655'; >> regexp(str,'(?<=_)\d{8}_\d{6}','match','once') ans = 20180927_161742 Note that th...

8 years ago | 0

| accepted

Answered
Create a Button in a figure which activates another function
function [x,y] = getpts_zoom(pic_analyze) x = []; % Must be specified in the main workspace. y = []; % Must be specified...

8 years ago | 0

Answered
How to generate a vector of uniformly distributed numbers around 1?
>> 2*rand(1,10) ans = 1.324304 0.866104 0.570201 1.248882 0.425728 1.720565 0.022849 1.249922 1.82846...

8 years ago | 0

| accepted

Answered
PDE toolbox: Undefined function 'mtimes' for input arguments of type 'function_handle'.
A <https://www.mathworks.com/help/matlab/function-handles.html function handle> is not a <https://www.mathworks.com/help/matlab/...

8 years ago | 0

Answered
Unexplainable huge performance degradation
_"Unexplainable huge performance degradation"_ *Explanation:* it is quite well documented that scripts are slow and so are gl...

8 years ago | 2

Answered
Increment different rates in same for-loop
*Method one: a loop:* N = 8; Z = nan(1,N); % preallocate for k = 1:N Z(k) = M1(k) * M2(ceil(k/2)) * M3(ceil(k/...

8 years ago | 1

Answered
Why are my vectors different lengths?
t = T*(1:numel(y));

8 years ago | 0

Answered
How to replace matrix NaN with string from cell array
C = {'# 2.537','1.219','0.457','0.214','# 0.120','0.245';'3.244','# 1.400','0.649','0.515','0.207','0.075'}; mat = str2doub...

8 years ago | 1

| accepted

Answered
Split data into different arrays of different sizes?
accumarray(index(:),a(:),[],@(v){v})

8 years ago | 0

Answered
Use while-end, if-end, break commands to solve the numerical problem
_"if anyone could point me in the right direction that would be appreciated"_ Your assignment points you in the right directi...

8 years ago | 0

Answered
how to access images from sub folders?
Using |dir|: D = 'path to directory F1'; S = dir(fullfile(D,'S*')); for ii = 1:numel(S) E = dir(fullfile(D,S(i...

8 years ago | 1

| accepted

Answered
finding row number of an array elements in related columns of a matrix
This is simple with the second output of <https://www.mathworks.com/help/matlab/ref/max.html |max|>: >> A = [5,4,1,4;1,2,4,...

8 years ago | 1

| accepted

Answered
I keep getting 'Undefined function or variable 't' ' after running the code
You do not explain how you are calling the function, but that is likely to be the problem. Perhaps you are trying to call it by ...

8 years ago | 0

Answered
trying to create a loop for for opening data files and plotting them
_"I want to change it so that a different file is opened with each loop but i'm not sure how"_ By following the guidelines in...

8 years ago | 0

| accepted

Answered
How to restore output of for loop in matrix
mat = zeros(10,2); for ii = 1:10 for jj = 1:2 mat(ii,jj) = sum((sam(ii,:)-cen(jj,:)).^2); end e...

8 years ago | 0

| accepted

Answered
Invisible graphics objects are selectable
You could use <https://www.mathworks.com/help/matlab/ref/uistack.html |uistack|> to move the legend behind everything else, and ...

8 years ago | 0

| accepted

Answered
Please help me in debugging my code?
The bug is on these lines: if (first_function(x_mid))*(first_function(x_lower))<0 x_lower = x_mid; else x...

8 years ago | 0

| accepted

Answered
writing multiple variables with eval into excel spreadsheet
_"But I had no idea how to export nicely..."_ You can't. Doing anything _"nicely"_ is impossible with that code. Becaus...

8 years ago | 0

| accepted

Answered
how to import an audio file ?
Use <https://www.mathworks.com/help/matlab/ref/audioread.html |audioread|>. Why do you think that your code is not working? What...

8 years ago | 0

| accepted

Answered
Multiplication of two matrices of different rank
_" I can come up with a tentative way that is to reshape ... and do the multiplication and reshape it back"_ That seems like ...

8 years ago | 0

Answered
How to create a set subsets?
Use a <https://www.mathworks.com/help/matlab/cell-arrays.html cell array>: S = {[1,4,7],[1,4],[4,5,7],[3,5,6],[2,3,6,7],[2,...

8 years ago | 1

| accepted

Answered
Saving output of for loop in array
Pload = linspace(1,2,4); N = numel(Pload); P = repmat(Pload,10,1); for k = 1:10 P(k,:) = P(k,randperm(N)); ...

8 years ago | 0

Answered
How do I call on a function created outside of the App Editor?
_"How do I actually point the App to the script located on my computer?"_ Simple, just change the MATLAB Search Path., becaus...

8 years ago | 0

Answered
I have to switch the max and min elements in a vector and assume vec = ceil(rand(1, 10)*100) is a vector containing 10 random generated integers. The script i have to provide will swap the maximum and the minimum element in the vector.
Even though this is homework without any attempt... here is a neat and efficient MATLAB way to do that (this swaps the first min...

8 years ago | 0

Answered
Splitting a column (and a numerical value in that column) into multiple columns
Divide, then use <https://www.mathworks.com/help/matlab/ref/mat2cell.html |mat2cell|>

8 years ago | 0

| accepted

Load more