Answered
My matlab code is only returning first output
You need to call the function with all three outputs, e.g.: [Vout, Iout, E] = kretsen2(); Very basic MATLAB concepts, such as ...

6 years ago | 0

| accepted

Answered
Convert a cell of 'yes' and 'no' into array of 1 and 0
out = strcmpi(Data,'yes')

6 years ago | 1

| accepted

Answered
Failed to save .eps file
"However, the file can not work with Latex editor as it converts the .eps figure into blank .pdf file. Any suggestion please?" ...

6 years ago | 1

Answered
row circular shift in matrix
Simpler using circshift, where k<0 shifts to the left and k>0 shifts to the right: M(row,:) = circshift(M(row,:),k,2)

6 years ago | 0

Answered
How do I ensure an input as a number and not a letter/set of letters?
It is more robust to return a character vector from input: p = 'Write the number of the converter you want to open here: '; x ...

6 years ago | 0

| accepted

Answered
How to parse an Nx1 string array without looping through N
Using one simple regular expression: C = {... 'nsasondewnpnC1.b1.20020428.184800.cdf'; ... 'nsasondewnpnC1.b1.2002042...

6 years ago | 0

| accepted

Answered
Sequential, row-wise reshape of an M–by–N matrix to form a 1–by–N vector
reshape(A.',1,[])

6 years ago | 1

| accepted

Answered
Selecting Elements of Matrix Given Index Value...
x = A(i,:) Or without the loop: x = A(omit,:) Very basic MATLAB indexing like this is explained in the introductory tutorials...

6 years ago | 2

| accepted

Answered
Why can't the variable "sumt" in my for loop keep on adding numbers?
"Why can't the variable "sumt" in my for loop keep on adding numbers?" Because of the class of mat. Most likely mat has class ...

6 years ago | 1

| accepted

Answered
column circular permutaion on a matrix
No loops: >> A = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]; >> S = [2,1,3,2]; % shifts >> [R,C] = ndgrid(1:4,1:4); >> B = A(s...

6 years ago | 0

Answered
What does this error mean? Undefined operator '*'
On this line f=@(r)... you defined f to be a function handle of an anonymous function with one input argument. Multiplication ...

6 years ago | 1

| accepted

Answered
If statement in loop not recognized
The problem is likely to be this invented syntax: T_per_rotor - 5 < Lift < 5 + T_per_rotor MATLAB does not have ternary logic...

6 years ago | 0

Answered
I accidently set my account in french
Scroll to the very bottom of this page. Click on this button (bottom left) Select the language you want to use.

6 years ago | 1

| accepted

Answered
Ensamblar varias submatrices en una matriz
>> M = [1,5,6,1,2,5;7,9,11,3,4,6]; >> V = nan(1,6); >> V(M(:,4:6)) = M(:,1:3); >> AA = diag(V) AA = 1 0 0 ...

6 years ago | 0

Answered
Plotting from a Loop - "Error: This statement is incomplete"
You are still writing the whole thing as a character vector. I don't see any examples in the documentation like that: https://w...

6 years ago | 0

| accepted

Answered
A Sprintf For Loop Breakdown
"I don't understand the sprintf what does the %3.3d.jpg do" It is confusing because that formatting string uses undocumented be...

6 years ago | 1

| accepted

Answered
How to divide an array into separate arrays when the division concerns a proportion of the cell?
% data: D = [1.1,1.2,1.4,1.7,2.0,2.3,2.7,3.1,3.6,4.2]; nb = 10; Lb = 2.45; x = [0;4;7;11;16;24.5]; % code: Lw = linspace...

6 years ago | 1

| accepted

Answered
How to divide the cell array content into columns?
You don't need the cell array, it would be simpler with array2table: M = max(mo(:,2:7)); Tit = array2table(M,...)

6 years ago | 0

| accepted

Answered
Return the position of a vector in a cell array that is length 3
>> C = {[1,2,3],[3,4,2,1],[1,2]}; >> X = cellfun(@numel,C)==3 % logical index X = 1 0 0 >> find(X) % linear index ans = ...

6 years ago | 0

| accepted

Answered
Using for loop to load multiple mat files of same names
Try something like this: N = 20; D = 'path to the folder where the files are saved'; for k = 1:N F = fullfile(D,sprintf(...

6 years ago | 0

| accepted

Answered
Replace a single character with a new line in a string
>> str = 'hello there how are you today'; >> regexprep(str,'w','\n') ans = hello there ho are you today And to remove that ...

6 years ago | 0

| accepted

Answered
Trying to get a symbolic derivative from a string that the user inputs
Use str2sym: https://www.mathworks.com/help/symbolic/str2sym.html

6 years ago | 1

| accepted

Answered
Converting floating-point hexadecimal (string input) to decimal
>> str = '2B.3A'; >> out = sscanf(str,'%lx.'); % use NUMEL(OUT) to detect integer or fractional >> dcp = numel(str)-strfind(st...

6 years ago | 0

| accepted

Answered
Merge cell that has common element
Simpler: A = {[1,2;1,3;2,4;3,4;2,5],[72,73],[5,6;6,7],[36,39],[71,80;72,80],[27,70;28,71],[39,51],[21,29]}; ii = 1; while ii<...

6 years ago | 1

Answered
Generating all possible products from set of values
One simple solution (although it does change the size of A on each iteration). C = {[1,2,3],[4,5],[6,7,8,9]}; % much better in ...

6 years ago | 0

| accepted

Answered
Plot function handle with vector input
newfun = @(x,y)yourfun([x,y]); fsurf(newfun) Could be generalized for any number of inputs: newfun = @(varargin)yourfun([vara...

6 years ago | 0

| accepted

Answered
Extracting from vector to multidimensional array using indices provided
In three lines (could be just one), no loops, and yes that extra 6 is taken into account! >> D = [1,1,1,1,1,4,4,4,4,4,7,7,7,7,7...

6 years ago | 0

| accepted

Answered
Matrix function for subtracting and adding numbers from values in a matrix
M = [0,0,0;0,9,0;0,0,0]; C = [0,1,0;1,-4,1;0,1,0]; while any(M(:)>4) M = M + conv2(+(M>4),C,'same'); end

6 years ago | 2

| accepted

Answered
Matlab: Select a variable name and find the corresponding value
One simple regular expression: str = fileread('test.subvar'); rgx = 'Wk1_(lr|voll)_m\D+(\d+)'; tkn = regexp(str,rgx,'tokens')...

6 years ago | 2

Answered
Generating a 3D matrix from multiple tables
'I have 469 scripts that all generate a table "numericData"... I wrote a code that loads the files...' There appears to be some...

6 years ago | 1

| accepted

Load more