Answered
how to convert to a cell array from a single precision array
Simpler to use num2cell: >> a = [1.1,1.2;2.1,2.2;3.1,3.2] a = 1.1000 1.2000 2.1000 2.2000 3.1000 3.2000 >> ...

8 years ago | 2

Answered
Why do I have to type '^' plus the next character two times?
This behavior is perfectly normal. It depends solely on your language and keyboard settings. Some keyboards use the ^ key (and ...

8 years ago | 2

| accepted

Answered
How to create and load a custom colormap?
Assuming that mymap is a variable in the workspace: colormap(gca,mymap);

8 years ago | 2

| accepted

Answered
Cell array: select only 1x3 double cells
Where C is your cell array: X = cellfun('length',C)==3; out = C(X) https://www.mathworks.com/help/matlab/matlab_prog/access-d...

8 years ago | 0

| accepted

Answered
find array inside a cell
Simpler in one line: >> A = {[1,2,4],[2,3,7],[2,5],[4,5,6]}; >> B = [1;2;3;6;8]; >> C = cellfun(@(m)intersect(m,B),A,'uni',0)...

8 years ago | 0

| accepted

Answered
What next in the code
Your function definitions are not correct. Instead of this invented syntax: Function 1 [W] = Naturalfreq(k,m) ... your code ...

8 years ago | 0

Answered
Is there an efficient way to create a matrix with all permutations of inserting one array into another?
Perhaps something like this: >> A = [1,5,6]; % remaining >> B = [4,3,2]; % reversed >> N = numel(A); >> M = toeplitz([B,zero...

8 years ago | 1

| accepted

Answered
Nested Indexing in a Single Line command
>> C = {'George: A5 == BB'; 'Anna: C3 == DD'; 'Smith: E2 == FFF'; 'Ken: G8 == HHHH'}; >> D = regexp(C,'^(\w+):\s*(\w+)\s*==\s*(...

8 years ago | 0

Answered
Saving file issue while trying to add variables
You are saving to different files: save(mysave,...) save(filename,...)

8 years ago | 0

| accepted

Answered
How can i find helper functions in Matlab?
At the bottom of the page, in a section entitled "Appendix", you will find the links to those functions:

8 years ago | 0

Answered
Add new elements into cell array inside a loop
This will store the data each iteration of both loops (but I did not change the logical conditions): N = size(TestData,1); % mu...

8 years ago | 0

Answered
Count number of repeated element before next different number in array?
>> D = diff([0,A==1,0]); >> find(D<0)-find(D>0) ans = 3 1 2 4

8 years ago | 0

| accepted

Answered
Subscript indices must either be real positive integers or logicals.
Better to iterate over integer indices rather than fractional values: V = 1:0.1:20; N = numel(V); M = nan(N,3); for k = 1:N ...

8 years ago | 0

| accepted

Answered
i have one variable which has value in an array and i want to make the power of all the value of array by another variable but getting value zero.any possible solution?
"any possible solution?" Solution to what, exactly? You calculate this (the loop is not required): >> alpha.^lambda ans = ...

8 years ago | 2

Answered
Horizontally concatinating the fields of a structure with different dimensions.
The different number of rows does not prevent them from being concatenated vertically: >> S.f1 = [0,1;2,3;4,5]; >> S.f2 = [6,7...

8 years ago | 0

| accepted

Answered
How to change string name?
The solution is to simply use indexing. For example, you could put all of your imported data into one cell array. You did not gi...

8 years ago | 2

| accepted

Answered
How to extract locations from strings of addresses?
Using one simple regular expression: >> C = {... 'Sustainable Industrial Systems, School of Chemical Engineering and Analyti...

8 years ago | 1

| accepted

Answered
I need some help with understanding the '2' close to the second d
>> fprintf ('The square of %d is %2d\n', [a;asq]) The square of 1 is 1 The square of 2 is 4 The square of 3 is 9 The squa...

8 years ago | 0

Answered
How to get a value from a matrix?
You should never compare for exact equivalence of floating point numbers, read this to know why: https://www.mathworks.com/matl...

8 years ago | 0

| accepted

Answered
Convert character matrix to numeric matrix
If you really need a 2x2 array then one straightforward way would be to use a cell array: >> A = {'AB','AC';'AD','AE'} A = ...

8 years ago | 1

| accepted

Answered
how can i split matrix into two part?
p1 = PP(1:v,:); p2 = PP(v+1:end,:); Note that I got rid of the superfluous square brackets.

8 years ago | 1

| accepted

Answered
How to create a loop function for a set of parameters from a file to define each parameters as variables
Dynamically creating variable names is not recommended. Read this to know why: https://www.mathworks.com/matlabcentral/answers/...

8 years ago | 0

Answered
Converting Cell Array into Array
for i=1:4 % Some calculations here rSet = ... C{i,1} = rSet; end vertcat(C{:})

8 years ago | 1

Answered
Too many input arguments.
MATLAB's ftrans2 has either one or two inputs. The documentation does not mention or show three input arguments.

8 years ago | 0

| accepted

Answered
fprintf for 6 array in double type and 2 date vectors
Your format string does not match your data. In your question you describe and show 2 char variables and 6 numeric variables, bu...

8 years ago | 0

| accepted

Answered
How to fill matrix in for loop?
>> (0.7:0.05:1).'*(0:0.2:1) ans = 0.00000 0.14000 0.28000 0.42000 0.56000 0.70000 0.00000 0.15000 0.30000...

8 years ago | 1

| accepted

Answered
Vectorizing for loop with with strcmp function inside
Reverse the loop order and get rid of the cell2mat: for ii = numel(A):-1:1 idx = strcmp(A(:,2),A(ii,1)) & strcmp(A(:,1),A(...

8 years ago | 0

Answered
How can I concatenate a large number of matrices?
C = arrayfun(fun,1:N,'uni',0); M = vertcat(C{:}) Read about how this works: https://www.mathworks.com/help/matlab/matlab_prog...

8 years ago | 0

| accepted

Answered
How to save inner loop data with outer loop data in one matfile
Using a structure (or any other array) is better than using dynamically named variables: m = 2; n = 3; r = 5; V = 2:2:20; f...

8 years ago | 1

| accepted

Answered
Turning numbers from string into doubles / into table with doubles
>> S = '[21, 22, 34,36]'; >> V = sscanf(S(2:end),'%f,') V = 21 22 34 36

8 years ago | 0

| accepted

Load more