Answered
Error using ==> eval
https://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html https://www.mathworks.com/matlabcentral/answers/304528...

10 years ago | 1

| accepted

Answered
Generate large nchoosek in batches?
<https://www.mathworks.com/matlabcentral/answers/303577-nchoose2-save-output-in-chunks>

10 years ago | 0

Answered
3D array to a column
Using this test matrix we can show how to rearrange into a column: >> r = reshape(1:8,2,2,2) r = ans(:,:,1) = 1...

10 years ago | 0

| accepted

Answered
How can I concatenate images that are stored in a cell array?
This works perfectly, concatenating the images if they all have the same size: % Read file data: S = dir('*.png'); C ...

10 years ago | 0

Answered
How do I address "Subscript indices must either be real positive integers or logicals" in an if/else statement nested in a for loop?
Your code compares the strings always at the same location in each string, i.e. always in position |place| for both strings: ...

10 years ago | 0

| accepted

Answered
Making an array Fails for mysterious reason (small stepsize)
_"I would have expected that x2 would be the equivalent of x1(1:end-1)"_ Nope. Those two values include floating point error ...

10 years ago | 1

| accepted

Answered
isdir / cd - unexpected results
|isdir| is based on |exist|, and in reality |exist| also checks for the existence of the current directory itself, _even if this...

10 years ago | 0

Answered
Maximum value of multiple individual arrays in structure
A simple <http://www.mathworks.com/help/matlab/ref/structfun.html |structfun|> does the job perfectly: A.TR0001 = [10:20]; ...

10 years ago | 2

| accepted

Answered
How to split a 3d matrix into sub-3d matrices?
It is easy to split that array using |mat2cell|, you just need to define a vector that defines how to split each of the dimensio...

10 years ago | 2

| accepted

Answered
How to do loop in the Workspace?
*Method One: |for| loop:* c = {rand(45,9), rand(45,9), rand(45,9), rand(45,9)}; d = cell(size(c)); for k = 1:numel(c)...

10 years ago | 0

| accepted

Answered
create structure array with eval
This is simple using dynamic fieldnames, and you do not need |eval|: Ergebnisse.(sprintf('auslenkung_Position_%d',Position)...

10 years ago | 0

| accepted

Answered
How can I see if one cell also exists in another cell array?
Have a look at this simple example, which shows how many strings of |A| are in |B|: >> A = {'cat','in','the','hat'}; >> ...

10 years ago | 0

Answered
Creating an Array with nested for loops.
Using a |for| loop: A = 1:4; N = numel(A); B = NaN(2*N-1); for k = 1:N B([N+k-1,N-k+1],:) = A(k); B(...

10 years ago | 1

Answered
Get while loop answer as a vector
n = 12; while n>1 if mod(n(end),2)==0 n(end+1)=n(end)/2; else n(end+1)=3*n(end)+1; end ...

10 years ago | 0

| accepted

Answered
using a switch structure to do a problem
switch lower(Month) case 'february' numMonth = 2; numDays = 28; case 'april' ...

10 years ago | 0

Answered
I need to create one vector from performing subtraction within another.
Just negate the output of <http://www.mathworks.com/help/matlab/ref/diff.html |diff|>: -diff(your_vector) eg >> vec =...

10 years ago | 0

| accepted

Answered
Why am i getting NaN using the equation "x = 2*x^2-x-5"?
Well, that is not hard to figure out at all. It really is as easy as putting a |disp(x)| inside the loop, and here are the first...

10 years ago | 0

Answered
Add arrows to an image
The easiest way is to use an <http://www.mathworks.com/help/matlab/ref/annotation.html |annotation|>, which places text and an a...

10 years ago | 0

Answered
Do I need Experts-Exchange to complement my Matlab learning?
The MATLAB website has (almost) everything you need to learn how to use MATLAB effectively. Start here: <https://www.mathwork...

10 years ago | 3

| accepted

Answered
Arrange and merge cell data
C = {... rand(1,40),rand(1,40),rand(1,40);... rand(1,30),rand(1,30),rand(1,30);... rand(1,50),rand(1,50),...

10 years ago | 0

Answered
I cannot get the timing to work correctly(using tic and toc), I cannot get my while ~(B|R|Y|G) to work, which i need it to reiterate 4 times before it BOOM!, Last, need help with making a sound that makes 3 sharp beeps. Thanks!
Have a play around with this, you can change the logic very simply: lim = 5; arm = true; % is armed. xpl = false; % ...

10 years ago | 1

| accepted

Answered
Convert .txt file data to matlab arrays
Try this: % Read the data: fid = fopen('file.txt','rt'); C = textscan(fid,'%s%s%[^\n]'); fclose(fid); C = [C{:}...

10 years ago | 0

Answered
Can you guys help me with my ASSIGNMENT? i just don't know how to answer it =(
*Method one: |bsxfun|* >> n = 5; >> bsxfun(@plus,n:-1:0,(0:n)') ans = 5 4 3 2 1 0 6 5...

10 years ago | 1

| accepted

Answered
How can I assign data from multiple spreadsheets to the same vector using one of the columns as the variable name?
Rather than using buggy and slow |eval|, simply place the data into a structure: [~,txt,raw] = xlsread('temp0.xlsx'); id...

10 years ago | 0

Answered
How to display strings with static text and varying numbers in text box?
You need to actually provide *one* string, not multiple arguments: set(handles.text1,'String',sprintf('%d of 200',i))

10 years ago | 1

Answered
How To do subplot in fallowing matlab Programme? it does two steps but after two steps it stops.
The error message tells you _exactly_ what the problem is. Did you read it ? When MATLAB throws an error (because something i...

10 years ago | 0

Answered
generate (not round) 2 decimal numbers
Here are two methods of providing random numbers rounded to two decimal places: >> randi([0,100],5)/100 ans = 0.8...

10 years ago | 0

Answered
cell array: larger/ smaller than statement
Much the same as per your last question: c = 3; Y = X(~cellfun(@(x)x<c,X(:,5)),:)

10 years ago | 1

| accepted

Answered
isnan cellfun and dropping rows
Making some guesses here, but this might do what you want: Y = X(cellfun(@(x)any(isnan(x)),X(:,4)),:)

10 years ago | 1

| accepted

Load more