Answered
Extract common elements of a struct from group of structs.
This is easy with a <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscalar-struct-array.html...

8 years ago | 1

| accepted

Answered
How to asses whether a single Char is member of an Array of Chars?
_"How to asses whether a single Char is member of an Array of Chars?"_ _"...single value comparisons of chars..."_ Of cour...

8 years ago | 0

| accepted

Answered
New file name with multiple variables
_"What am I doing wrong?"_ MATLAB does not implicitly convert the numeric |dpi| to the string that represents that number, it...

8 years ago | 0

Answered
what is the different between B^2 and B.^2
These are certainly NOT the same operations, and the sizes of the matrices does not determine which operations to use. You need ...

8 years ago | 6

| accepted

Answered
Matlab 2017b and 2018a
Here are the differences between R2017b and R2018a: <https://www.mathworks.com/help/matlab/release-notes.html?rntext=&startre...

8 years ago | 0

Answered
Help me the loop problem
For various reasons, using a loop is not a good approach. Using |colon| or |linspace| will be numeric more stable, and more effi...

8 years ago | 1

| accepted

Answered
Creating ASCII file with 2 columns
Your |fprintf| calls do not make much sense. In particular, you define each |fprintf| with *one* |%s| format, even though you wa...

8 years ago | 0

| accepted

Answered
Assembly of matrices using for loop
Following the examples in the MATLAB documentation: <https://www.mathworks.com/help/matlab/import_export/process-a-sequence-o...

8 years ago | 2

Answered
How can I generate a vector in a for loop with different sizes? In for iii, I used str2double(strrep(num2str(e), ' ','')) to store it. It worked. How can I get f to generate a stored vector if f = e ?
The old-fashioned way: >> x = [2,5,1,2,4,1,1,3]; >> cell2mat(arrayfun(@(v,n)v*ones(1,n),x(2:2:end),x(1:2:end),'uni',0)) ...

8 years ago | 1

| accepted

Answered
How to use the same variable in different functions in GUI MATLAB
At the end of a callback |handles| is not stored automatically, or somehow passed to other callbacks/functions. You have to do t...

8 years ago | 0

Answered
Plotting of an inline function
You should use <https://www.mathworks.com/help/matlab/ref/str2func.html |str2func|> to create an <https://www.mathworks.com/help...

8 years ago | 2

Answered
How to get the row index of most similar row
The fifth row seems to be closest (in a least-squares sense): >> A = [1.0,2.02,3.2,3.56;0.0,3.30,1.2,0.3;1.2,3.80,1.23,9.3;...

8 years ago | 1

| accepted

Answered
How to store results from a function in a workspace
Without function output arguments, you are not going to get any function outputs. Its author simply displayed some values, which...

8 years ago | 1

| accepted

Answered
How to convert a structure int16 into a matrix?
You don't need to do anything extra, because this is already the numeric data that you want: VAR.C(:,3) |VAR| is a struc...

8 years ago | 0

| accepted

Answered
How to avoid repetition?
One easy solution based on <https://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|>: S = size(A); [~,Y,Z...

8 years ago | 0

| accepted

Answered
count number with continuous numbers of 1's ?
>> B = [0,diff(A)>0] B = 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 ...

8 years ago | 0

| accepted

Answered
How to find a particular string in a stuct which has multiple fields?
Why not something simple like this?: >> S = load('MyStruct.mat'); >> MyS = S.MyStruct; >> strcmp({MyS.abc},'mnop') ...

8 years ago | 1

| accepted

Answered
how to create function handle for conditional sine wave
fun = @(t) sin(3*pi*n) .* (n>=0 & n<=5);

8 years ago | 0

Answered
Matlab coder str2num alternatives?
As far as I can tell from that <https://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation-alphabetical-...

8 years ago | 1

| accepted

Answered
Patients code to text for table
_"Lets say that somewhere in a 630x38 matrix there is a "1". I need a table with the same dimensions but where (place) there is ...

8 years ago | 0

| accepted

Answered
How process many structured arrays at once
_"I want to plot/process some test data, but it was stored in structured arrays with unhelpful / sequential names (Signal_000, S...

8 years ago | 1

| accepted

Answered
How do I save a .mat file and .py file automatically with a 'variable's' value as filename using MATLAB?
G = 20; N = 10; F = sprintf('%d_%d.mat',G,N); save(F,...)

8 years ago | 0

| accepted

Answered
Looping command for vectors with common string prefix
numArrays = 25; milliq = cell(numArrays,1); for n = 1:numArrays fld = sprintf('PortAvilliq%d',n); milliq{n...

8 years ago | 0

| accepted

Answered
Matlab problem. Command find
You probably need to use <https://www.mathworks.com/help/matlab/ref/bsxfun.html |bsxfun|>: bsxfun(@lt,B,A)

8 years ago | 0

Answered
I want to find the location of the 1s in an array but only if they have a 0 before or after it. Can anyone help?
*Method one: <https://www.mathworks.com/help/matlab/ref/strfind.html |strfind|>:* >> x = [0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,0];...

8 years ago | 0

| accepted

Answered
obtain column value for lowest element in each row of an 2D array
If you want to get the column indices, then this is the second output from <https://www.mathworks.com/help/matlab/ref/min.html |...

8 years ago | 0

| accepted

Answered
create a array base on specific condition ?
>> idx = A~=0; >> A(idx) = [-diff(A(idx)),1] A = 0 0 0 2 0 0 0 0 3 0 0 2 0 0 0 1 0...

8 years ago | 1

| accepted

Answered
How to plot in a for loop using real numbers?
You probably want to use indexing, something like this: q = 4000; L = 10; E = 200*(10^9); I = 363.76 * (10^-8); ...

8 years ago | 0

Load more