Answered
Can I assign values to an array in a diagonal direction from a reference point on that array?
Perhaps: X = [... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

9 years ago | 0

| accepted

Answered
How can I view numeric array elements in edit text box, in Guide?
|a2| is of type logical, and is definitely not string, numeric, or cell array. Did you read the error message? One simple fix...

9 years ago | 1

| accepted

Answered
Is that possible to index cell array with a string instead of a value? If not, suggest any that can do so?
Use a <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscalar-struct-array.html non-scalar st...

9 years ago | 0

| accepted

Answered
How to use negation in regexp in matlab?
Using |regexp| is overkill here, as all you are checking is the first character of the string. Much simpler would be to use <htt...

9 years ago | 0

| accepted

Answered
Find the indexes of all the zeros or nonzeros in a cell array that contains empty cells
>> A = {2,5,0,10,0,[],22,0,13}; >> cellfun(@(a)~isempty(a)&&a>0,A) ans = 1 1 0 1 0 0 1 0 1 But note that...

9 years ago | 1

| accepted

Answered
How to make output single column in the same line as your calculation
reshape(X,[],1) for any array/matrix/vector X

9 years ago | 0

| accepted

Answered
For-loop instantly jump to largest value
You do not need such pointlessly complex code using lots of |elseif| as if MATLAB was an ugly low-level language like C++. *Keep...

9 years ago | 0

Answered
I want to plot a piecewise function. So could someone tell me what N, a positive value, would be?
>> x = -2*pi:0.001:2*pi; >> N = 3; *Method one: |min| and |max|:* >> y = max(-N,min(N,tan(x))); *Method two: log...

9 years ago | 0

| accepted

Answered
How would I extract the first and last nonzero numbers from this array?
Simpler: >> V = [0,0,0,0,0,0,0,1,2,2,2,3,0,0,0,0,0,3,2,2,2,2,7,0,0,0,0,0,0,0]; >> D = diff([0,V,0]==0); >> [V(D<0);V(...

9 years ago | 3

Answered
How to pass parameters computed in different functions separately into another function?
I think that <https://www.mathworks.com/help/matlab/matlab_prog/nested-functions.html nested functions> are the simplest and mos...

9 years ago | 0

| accepted

Answered
How to remove a some part of a string from a string?
>> str = 'Pdus_ENGINE_PKG_ENGINE_ECU_Stat_PT_SENSOR_Container'; >> regexprep(str,'engine_pkg_engine_','','ignorecase') a...

9 years ago | 2

| accepted

Answered
Is It Possible to Add Pop-Up Text When Clicking on a Specific Line In Plot
Sure: add a |ButtonDownFcn| function for each line object: <https://www.mathworks.com/help/matlab/ref/primitiveline-propertie...

9 years ago | 0

Answered
Randomly combine between 2 vector
To randomly "shuffle" the elements of a vector you can use <https://www.mathworks.com/help/matlab/ref/randperm.html |randperm|>:...

9 years ago | 0

| accepted

Answered
Print massive without rows and columns name
fprintf('%s\n',sprintf(' %.2f',mat))

9 years ago | 1

| accepted

Answered
How to assign a user input to a variable in matlab when using uicontrol 'string'?
hnd = uicontrol('Parent',d,... 'Style','edit',... 'Position',[20 330 210 60],... 'String','-4'); str = get(hnd,'String') ...

9 years ago | 0

| accepted

Answered
i= 1 Undefined function 'circulant' for input arguments of type 'double'. Error in generator (line 194) A11 = circulant(a11,1);
The |circulant| function is not an inbuilt MATLAB function. There are several |circulant| functions available for you to *downlo...

9 years ago | 0

| accepted

Answered
String not read correctly
*Explanation* _"...the ouput is c = 'S'. Why isn't the output c = 'R'?"_ Because your code does not do what you think it d...

9 years ago | 3

| accepted

Answered
how to extract another matrix out of a big matrix
>> A=[420 0.23;421 0.26;422 0.25;423 0.24;424 0.28;425 0.27] A = 420 0.23 421 0.2...

9 years ago | 1

Answered
How do I update a struct array in a for loop?
Just use indexing to put the data into a <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonsca...

9 years ago | 0

| accepted

Answered
How do I insert a Matrix in a Cell of a Cell array?
You used the wrong kind of brackets: >> C = {}; >> C{1,1} = [1,2;3,3] C = [2x2 double] >> Did you know...

9 years ago | 0

Answered
How MATLAB Recognizes Command Syntax
Use |builtin|: >> clear = 0 clear = 0 >> builtin clear clear >> clear >>

9 years ago | 0

| accepted

Answered
Vector definition, what is expected behavior when separating elements by comma and spaces are used in the expression?
This is explained in the MATLAB documentation: <https://www.mathworks.com/help/matlab/matlab_prog/case-and-space-sensitivity....

9 years ago | 1

| accepted

Answered
Merge two columns into one
Ugly |eval| is not required, a simple use of |sprint| and |sscanf| is more efficient: >> x = [1;2;3]; >> y = [5;6;8]; ...

9 years ago | 3

Answered
Replace an element in a cell array when a certain value only occurs once?
Simpler: >> a = rand(20,1); >> c = {a,a,a,a,1,a,a,a,1,a,a,a}; >> c(cellfun(@isscalar,c)) = {-1}

9 years ago | 1

| accepted

Answered
How to convert string within a cell array into an array?
*Method one: concatenation and |sscanf|:* >> c = {'[18,1]' '[18,2]' '[18,3]' '[19,4]'}; >> reshape(sscanf([c{:}],'[%f,%f...

9 years ago | 0

| accepted

Answered
I run this identity test and get this response....what am I doing wrong
You define a function with one output argument |result|: function result = singularitytest(A) Inside the function you de...

9 years ago | 0

Answered
Undefined function or variable 'dfdes'
You need to define those functions yourself, or get them from someone else. They are not inbuilt MATLAB functions. The screen...

9 years ago | 0

Answered
Histogram using MAX not frequency values within a Bin?
One way would be to assign the values to groups using |bsxfun| and then use |accumarray| to get the maximum of each group: ...

9 years ago | 0

| accepted

Answered
Hi everyone, I want to find the polynomials from root. I want to get a value without decimal, how is that possible? Please find the example below for more clarification.
>> V = poly([ -0.1667 + 1.2802i -0.1667 - 1.2802i]) V = 1 0.3334 1.6667 >> [N,D] = rat(V,0.00...

9 years ago | 0

| accepted

Answered
Find the existence of a character from a struct
Using a <https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html comma-separated list> and <https://www.ma...

9 years ago | 2

| accepted

Load more