Answered
How to load text file without header, programmatically specifying names of variables?
Your code would be much simpler if you used a <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-n...

9 years ago | 0

| accepted

Answered
min/max values in 3 dimensional arrays
Perhaps using <https://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|>: >> X = [15, 1, 5.23; 15, 2, 6.33; 1...

9 years ago | 1

Answered
toolboxes available to home edition
They are listed here: <https://www.mathworks.com/store/link/products/home/new>

9 years ago | 0

| accepted

Answered
Access data in a structure using a loop
*Best Solution: non-scalar structure* Your code would be a lot simpler if you used a <https://www.mathworks.com/help/matlab/m...

9 years ago | 0

| accepted

Answered
how to sort the vectors to positive n negative of same elements?
>> v = [1,-2,3,4,5,6,7,8,9,77,44,88,99,-1,95,-6,-7,-8,-9] v = 1 -2 3 4 5 6 7 8 9 77 44 ...

9 years ago | 0

| accepted

Answered
How to add a variable to a filename while renaming it
Untested, but this should get you started: ptx = ''; % directory path S = dir(fullfile(ptx,'*.txt')); for k = 1:numel...

9 years ago | 0

| accepted

Answered
i get error saying that z should be a matrix and not a scalar
Z=7*sin(pi.*X).*cos(3*pi.*X);

9 years ago | 1

| accepted

Answered
Help in making code involving strings and cell array simpler and run faster
Your syntax is not correct. In MATLAB |[]| is *not* a list operator, it is a <https://www.mathworks.com/help/matlab/ref/specialc...

9 years ago | 1

| accepted

Answered
real part of a complex number
Because you have assigned the name |real| to a variable. When you shadow an inbuilt function or variable with your own variable,...

9 years ago | 1

Answered
Color conversion RGB to Lab
The <https://www.mathworks.com/help/images/ref/makecform.html |makecform|> default illuminant is ICC, but sRGB uses D65. So you ...

9 years ago | 1

Answered
Replace values in matrix
>> A = [2,5,7,12,9,4]; >> B = [1,4]; >> A(~ismember(1:numel(A),B)) = NaN A = 2 NaN NaN 12 NaN NaN

9 years ago | 2

| accepted

Answered
How can I save multiple figures with partly same variable name?
Use <https://www.mathworks.com/help/matlab/ref/sprintf.html |sprintf|>: name = 'Picture'; fnm = sprintf('Peaks_%s.fig',nam...

9 years ago | 0

| accepted

Answered
How to Put These Vectors in a Matrix?
Here is one way: >> A.B.G = [1 2 3]; >> A.C.G = [4 5 6]; >> A.D.G = [7 8 9]; >> A.E.G = [10 11 12]; >> A.F.G = ...

9 years ago | 1

| accepted

Answered
Cell Array to Matrix but keep zeros
Where |C| is your cell array: C(cellfun('isempty',C)) = {[0,0;0,0]}; out = cell2mat(C); Here is a complete working simp...

9 years ago | 0

| accepted

Answered
insert matrix index to specific number
For MATLAB versions without |repelem| (pre R2015a): >> index = [1 6 10]; value = [4 6]; >> cell2mat(arrayfun(@(d,v)repma...

10 years ago | 0

Answered
How to find the minimum number in matrix among the repeated array
This will give you the first three columns: A = [... 36,2,896,965 36,2,965,1354 36,4,1354,1400 ...

10 years ago | 0

Answered
How do I get an index like with ismember, but with values representing the number of occurances?
>> A = {'monday', 'tuesday', 'thursday', 'monday'}; >> B = {'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturd...

10 years ago | 0

| accepted

Answered
Convert Matlab engine outputs to numpy arrays
The MATLAB Engine for Python: <https://www.mathworks.com/help/matlab/matlab-engine-for-python.html> returns these data cla...

10 years ago | 4

Answered
Using a letter as a case in a switch-case code
Always use the |'s'| option with <https://www.mathworks.com/help/matlab/ref/input.html |input|>, like this: temp = str2doubl...

10 years ago | 2

Answered
How to separate string data and convert it to number?
>> str = 'BE1234U1234'; >> sscanf(str,'BE%dU%d') ans = 1234 1234 for example: >> str = 'BE1234U5678'...

10 years ago | 1

Answered
Remove duplicate values, but keep the initial
>> x = [0,0,0,1,1,0,0,0,1,0,1,0]; >> idx = [1,1+find(diff(x)~=0)] idx = 1 4 6 9 10 11 12 >> vec...

10 years ago | 1

| accepted

Answered
I need a power function for a boolean matrix.
>> A ^ 2 ans = 1 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 ...

10 years ago | 0

Answered
Import a specific structure with numbers in MATLAB
Read the file into a string using |fileread|, and then try this: >> str = 'XY={{0.3`,0.38237129451839642`},{0.4`,0.43291827...

10 years ago | 1

| accepted

Answered
How to use structure properly?
Have a look at these two lines: [otpt] = teststruct(inpt); [otpt] = teststruct1(inpt); the first line creates |otpt| in...

10 years ago | 0

| accepted

Answered
Rotating an entire axes in Matlab Guide
The easiest way to rotate the axes is to use the inbuilt function <https://www.mathworks.com/help/matlab/ref/camorbit.html |camo...

10 years ago | 0

Answered
Subtracting elements with constraints
Your question is not clear where you want these constraints applied. *Option one: constrain output values:* B = bsxfun(@m...

10 years ago | 1

| accepted

Answered
Undefined function 'SigActFun' for input arguments of type 'char'
@Balaji k: MATLAB does not have any function named |SigActFun|. If you mean this third-party function that any internet search e...

10 years ago | 1

| accepted

Answered
Assigning output from separate .m file to variable
_"IdealAir interpolates from a table. It takes 3 arguments (a value, the variable to which the value is assigned, and the output...

10 years ago | 2

| accepted

Answered
exist function check file
The <https://www.mathworks.com/help/matlab/ref/inputdlg.html |inputdlg|> help states clearly that the function's _"returned vari...

10 years ago | 1

| accepted

Answered
How can i create dynamic file name?
name = input('file name and extension: (ex: 1234.txt): ','s'); [pth,name,ext] = fileparts(name); new = sprintf('dart_%s_%d%...

10 years ago | 2

Load more