Answered
Problems with cell array
min(cat(2,c{1:size(c,1)+1:end}),[],2)

11 years ago | 0

Answered
How do I copy fields name and their contents to another struct variable?
a(1).x = 1 a(2).x = 2 a(3).x = 3 b(1:2) = a(2:3) % Is this what you want? b(1) now equals a(2) ...

11 years ago | 1

Answered
how to access data from cell array within another cell array
I have trouble recreating your data: C = {{1 2 3}{10 11}} gives me a 1x2 cell array with cells as elements: % C = ...

11 years ago | 1

| accepted

Answered
i am facing problems using the helpdlg() command
You can put the strings into a cell array of strings, like this: helpdlg({'Line 1', 'Line 2 is followed by an empty line', ...

11 years ago | 0

| accepted

Answered
Finding smallest value in nested structure
I think the for-loop approach is the best option. You can use that to store each value in a matrix first: Ni = numel(subj...

11 years ago | 0

Answered
How to combine numerical values into one?
Use the power of ARRAYFUN: a = [0 1 1] b = [1 0 1] c = arrayfun(@(k) sprintf('%d%d',a(k),b(k)),1:numel(a...

11 years ago | 0

Answered
graph of y = 1 / ( cos(x) -c)
I think these lines do not behave as expected: C = cos(x0) - (1./y0); % these values are never used for C= 1:7 y = 1....

11 years ago | 0

Answered
Array Building using Dynamic Field Reference using an Array of Strings
Something along these lines? Data.Field1=[1; 2; 3] Data.Field2=[4; 5; 6] C = struct2cell(Data) Output = cat(2,C...

11 years ago | 0

| accepted

Answered
how to fix the warning message with polyfit?
Are you sure you want to fit your data with a polynomial of degree that scales with the number of elements of X? Moreover, is a...

11 years ago | 0

Answered
Returning last value of while loop
You can return multiple outputs with functions function [q, k] = myimproperintegral(f,a,b,tol) ...

11 years ago | 0

Answered
Changing the step in a for loop
For-loops in matlab behave a little different than for loops in C. You might be in need of a While-loop. for k=1:5 di...

11 years ago | 0

Submitted


fourplot(X)
Four-plot for efficient visual exploratory data analysis, with box plot (V3.0, feb 2015)

11 years ago | 2 downloads |

3.0 / 5
Thumbnail

Answered
How do I set a certain duration for a stimuli presentation?
I suggest you do not use delete and pause. Here is an alternative x = [1 2 6 8 3] ; y = [7 1 3 9 6] ; sti...

11 years ago | 3

Answered
I want to break my sample like this. Problem with my logic. need help
data = 'GAATGCT' N = 4 ; for k= 1:numel(data)-N subsample = data(k:k+N) ; disp(subsample) end

11 years ago | 0

| accepted

Answered
i want to make random size of my datasample.output must give random size array. As i am very new in matlab. please help.
you want a random size sample? Like this, perhaps: DATA = 'ATCG' K = randi([10 20],1) % random number between 10 and 20...

11 years ago | 0

Answered
stretching a non-monotonically increasing vector
You do want to take a look at interp1 t = [1 3 4 6 9] ; % irregular time intervals y = [0 1 1 0 1] ; t1 = 1:9 ; %...

11 years ago | 0

Answered
Split a matrix in two matrix according a criterion
% sample data G = {'wt','wt','ko','ko','wt'} V = [10 20 30 40 50] % transform G into numbers, there are other way...

11 years ago | 0

Answered
I want to add a 20 by 20 matrix to a 50 by 50 matrix ? the resuting matrix should be of 50 by 50 .
For arbitrary sized 2D matrices A and B: % example data A = ones(3,5) B = 2*ones(4,2) % engine szA = si...

11 years ago | 0

Answered
character to variable that already exists in the workspace
You should store your data into structs or in cell arrays: scoreStruct(1).values = [1 2 3] scoreStruct(2).values = 10 ...

11 years ago | 1

Answered
Add title to current axes
set(get(gca, 'title'), 'string', 'My First Title')

11 years ago | 0

| accepted

Answered
How to arrange rows of a matrix to get a specific column in order?
Yes, there is! Take a look at SORTROWS M = [1 2 3 ; 2 3 1 ; 3 1 2] sortrows(M,2)

11 years ago | 1

Answered
Central part of a matrix
Something like this? M = spiral(10) % test matrix S = 2 % s elements around the central position % the resulting mat...

11 years ago | 1

Answered
How to mix order of rows in a matrix?
Very much the same procedure; M = repmat(1:10,4,1).' % example data r = randperm(size(M,1)) % permute row numbers M...

11 years ago | 1

| accepted

Answered
Storing all values into an array
You want to do something like this: N = 10 ; A = zeros(N,1) ; % pre-allocation, will speeds things up for k=1:N, ...

11 years ago | 0

| accepted

Answered
Selecting a random number with some probability
For two values it is simple VAL = [10 20] % 2 values P = .8 % probabbility of selecting first value Ndraw ...

11 years ago | 1

Answered
Find a value with cell array.
No need for cell2mat, simple concatenation would do: val = [A{:,1}] tf = val == 7 out = A(tf,2) which you can do a...

11 years ago | 1

| accepted

Answered
if else elseif and other conditions
Seems fine to me. Did you try?

11 years ago | 1

| accepted

Answered
Plotting a circel using fill funtion
You might also be interested in learning about the function rectangle, as in: rectangle('curv',[1 1],'position',[0 0 1 1],'...

11 years ago | 0

Answered
How to vectorize assignment of a structure's field value
More matlab-y, but completely gibberish for the non-native matlab speaker: A = 10:10:50 C = num2cell(A) [objects(1:nu...

11 years ago | 0

Answered
how to choose matrix columns randomly?
Exactly 80 vs 20? Or in approximation? And how many columns? I also assume the number of rows in A and B are the same. A sug...

11 years ago | 0

Load more