Answered
extract an array from cell with its indexes
>> clstr = {[],8,[7,8],[6,8],[6,7],[6,7,8],5,4,[4,8],[4,7,8],[4,6,7],[4,6,7,8],[4,5],[4,5,8],[4,5,7]}; >> ter = [4,5]; >> id...

7 years ago | 0

| accepted

Answered
How would I create a matrix from the following strings
Note that specifying a suitable format string is much more efficient than importing as character/string and then converting afte...

7 years ago | 2

| accepted

Answered
Merging Arrays in a Struct and Sorting them
A more robust solution, where v is your 2x1 structure: out = sort([v.IndividualStiffnessMatrix]) Note that your field name is ...

7 years ago | 0

Answered
How to save the several results of a program in an array?
Assuming that those means are scalar values, then a simple loop: dV = [10,20,30,40,50]; nV = numel(dV); averf6 = nan(1,nV); ...

7 years ago | 1

| accepted

Answered
How can I repeat the values of an array in the same order?
>> W = [1,2,3,4,5]; >> W2 = repmat(W,1,3) W2 = 1 2 3 4 5 1 2 3 4 5 1 2 3...

7 years ago | 1

| accepted

Answered
Why isn't the progress bar in the center of the waitbar after setting the position?
The designer of the inbuilt waitbar used a fixed absolute size for the bar's axes, defined in points. Apparently they did not co...

7 years ago | 0

| accepted

Answered
Repeating Values List Problemc
>> ix = [10,11,12,12,12]; >> iy = [2,3,4,5,6]; >> [ixnew,~,idx] = unique(ix(:),'stable'); >> iynew = accumarray(idx(:),iy(:),...

7 years ago | 0

| accepted

Answered
how can I creat a matrix of all possible combinations of zero and ones across eight digits.
>> dec2bin(0:7) % try 0:255 ans = 000 001 010 011 100 101 110 111

7 years ago | 3

Answered
Exact string match to confirm the string existence in the file
>> txt = fileread('input_data.txt'); >> spl = regexp(txt,'\w+','match'); >> any(strcmp('var_ab',spl(1:2:end))) ans = 0 >> an...

7 years ago | 0

| accepted

Answered
How do I generate numbers
V = randi([100000,999999],1,100)

7 years ago | 0

Answered
how to get element of a matrix that defined as a function?
That numeric matrix is only created when the function is called, it does not exist beforehand. So you need to call the function...

7 years ago | 0

| accepted

Answered
How to run checks on all rows of structure?
"How to run checks on all rows of structure?" Your structure only has one row (and four columns): >> size(s) ans = 1 4 ...

7 years ago | 0

| accepted

Answered
How to print all loaded files in the workspace?
https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html Adapting the example from the documentatio...

7 years ago | 1

| accepted

Answered
Loop different variables from workspace
The most important thing is to always load into an output variable: Q = load(...) % Q is a scalar structure where the fields o...

7 years ago | 1

| accepted

Answered
How do I find the indices of the value of my matrix?
The answer depends entirely on how you define "equals" for floating point numbers: >> [R,C] = find(abs(XX - -69.19)<1e-4) R = ...

7 years ago | 0

| accepted

Answered
Printing matrix to display error message, why?
The error message "Error using printMatrix Too many output arguments" tells us that you tried to call the function printMatrix w...

7 years ago | 0

Answered
Check if connect 4 occurs in matrix
Simple, efficient, and robust using conv2: >> M = [0,0,0,0,0,0,0;0,0,2,1,2,2,0;1,2,2,2,1,1,2;2,1,1,1,2,1,1;2,1,2,1,2,2,2;1,2,1,...

7 years ago | 2

| accepted

Answered
How do I create a new folder each time I run a code?
The main problem is that you are not passing nextname the path of that location, so instead of looking in the location that you ...

7 years ago | 0

| accepted

Answered
how to conver a string to a array or matrix
You can easily avoid evil eval by using str2func: >> a = '[0 1;J 2]'; >> v = 'J'; % comma-separated variables, e.g. 'J,K,L' >...

7 years ago | 0

| accepted

Answered
I have a cell array with arrays of values 0 and I want to clear those
"I keep getting an exception for my for loop.Index exceeds matrix dimensions." You get this error precisely because you are rem...

7 years ago | 0

| accepted

Answered
Converting anonymous function to a matrix
"How can I build up anonymous functions from other anonymous functions" Just call the functions, exactly like you would any oth...

7 years ago | 0

Answered
Is there a right order for input variables in a function?
"Is there a right order for input variables in a function?" Yes: MATLAB function inputs are positional: The 1st input provided...

7 years ago | 0

| accepted

Answered
How to take my output and store it into a 6x6 array
>> board = [1,2,3,4,5,6,7,8,11,12,13,18,29,30,31,34,35,36]; >> out = zeros(6,6); >> out(board) = board; >> out = out.' out =...

7 years ago | 0

Answered
How to Find the specific character between two repeated strings.
>> V = '<NETWORK>CAN</NETWORK> <DESCRIPTION>Despacito</DESCRIPTION> <INITVALUE>0</INITVALUE><FRAME>ADAS_A08SC_FD</FRAME> <DATA>A...

7 years ago | 1

| accepted

Answered
simple way of matrix array resorting
Robust: Q = [A(:),B(:),C(:)]

7 years ago | 1

| accepted

Answered
Cycle counting from 0
>> M = [0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0]; >> D = diff([false;M(:)==0;false]); >>...

7 years ago | 0

| accepted

Answered
Loading Multiple .mat files, but not into structure
"not sure how to do this within a structure though" So now is a good time to learn! Instead of learning the worst way of doing ...

7 years ago | 1

| accepted

Answered
Extract *.mat-Variables with same names from different directories
"A simple 'load' command will give me a strut, which I can't do much with." "Ideally, I'd like a workspace containing all 96 va...

7 years ago | 0

| accepted

Answered
n! permutation matrices
A purely numeric solution without loops: >> I = eye(4); >> M = reshape(I(:,flipud(perms(1:4)).'),4,4,24) M = ans(:,:,1) = ...

7 years ago | 0

Answered
Map between two cell arrays
"All the values of course." Then you cannot use containers.Map: even if you manage to sort out everything else (those numeric i...

7 years ago | 1

| accepted

Load more