Answered
Building an array of values from multiple .txt files
*EDIT* % Use vertical allocation and CollectOutput: C_abxyz(i,:) = textscan(fid,'%f%f%f','Delimiter',',','Headerlines',1,'Co...

14 years ago | 1

| accepted

Answered
Basic probability question
% Preallocate 1s Out = ones(100,1); % 40% shuld be 2s num = round(numel(Out)*.4); % Randomly scatter the 2s amon...

14 years ago | 0

Answered
datafitting problem with lsqcurvefit
Read better the documentation of _Fun_ in the _Input Arguments_ section.

14 years ago | 0

Answered
date and time in CSV file
Use textscan

14 years ago | 0

| accepted

Answered
How to enter an input in an active 'while' loop?
x = 1; while x == 1 x = input('Value for x: '); end

14 years ago | 0

Answered
matching from a distribution
[I] idx = B > A + .1*A | B < A + .1*A; B(idx)

14 years ago | 0

Answered
Counting the number of digits
To count integer part ceil(log10(abs(A))) *Edit* floor(log10(abs(A)+1)) + 1

14 years ago | 8

Answered
Detecting a string and getting the entire sentence
s = ['My name is X. I am working on Matlab. I work on it everyday.'... 'I do many mathematical analysis with matlab.'....

14 years ago | 1

Answered
Fprintf and display in the same script
n = 0:15; f = 1/sqrt(5).*(((1+sqrt(5))/2).^n-((1-sqrt(5))/2).^n); sprintf('F%02.0f = %3.0f\n',[n;f]) disp( strcat('F', ...

14 years ago | 0

| accepted

Answered
title to a table
After you created the uitable (or when declaring the figure): set(cgf,'Name','myName') set(gcf,'Name','myName','NumberTitle...

14 years ago | 0

Answered
Making structure arrays programmtically.
If you have the stats TB you can import a file directly as a <http://www.mathworks.com/help/toolbox/stats/dataset.html dataset o...

14 years ago | 1

| accepted

Answered
how can i write delete query in matlab
*EDIT* Use: curs = exec(conn,'delete query') where delete query is one of the expression as indicated here http://www.w3sch...

14 years ago | 0

Answered
MATLAB and rounding
<http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F FAQ 6.1> _x-y_ cannot be represe...

14 years ago | 1

Answered
trimming numbers
A = [3829 36203 371]; % Robust to different 'lengths' fix(A ./ 10.^(ceil(log10(abs(A)))-2))

14 years ago | 0

| accepted

Answered
highest frequency
A = [3423 3420 3423 3421 3423 3523 3524 3545 3644 3999]; unA = unique(A); counts = histc(A,unA); [m,idx] = max(counts...

14 years ago | 0

Answered
Question about fsolve
Do you mean something like the solution here http://www.mathworks.com/matlabcentral/answers/2467-solve-a-nonlinear-system ?

14 years ago | 0

Answered
Restrict access to Matlab code
<http://www.mathworks.com/help/techdoc/matlab_prog/f7-38053.html#bsc58yj-1 Protecting Your Source Code>

14 years ago | 1

| accepted

Answered
Multiple File Input Processing
First of all you don't need to use eval for this task. load(Filename(i).name); Second, does the data file contain headers?...

14 years ago | 0

| accepted

Answered
How to Plot Multiple variables ?(not multi-plot)
Very bad practice and as a proof you already have problems for such a simple task. Use dynamic fields in structures or cell arra...

14 years ago | 0

Answered
avoding loops by vectorization
outer_x = bsxfun(@plus, x_i, d_del(1,:)*cost.'); *Don't* use _cos_ (i renamed it in _cost_) as a variable since it's already...

14 years ago | 1

Answered
Pricing a bond with different YTM (at cross sectional level)
N = 100; C = 5; %Semi-annual YTM = rand(1,10)*.1; P = sum([C./(1+YTM(1:9)).^(1:9), (N+C)/(1+YTM(10))^10]); Or...

14 years ago | 0

Answered
(a^b) mod c
If you're looking for elementwise elevation to a power then: mod(a.^b,c)

14 years ago | 0

Answered
vector values
Are you looking for the ticks on the X axis (their positions and labels)? Then in general for a figure containing one axes: ...

14 years ago | 0

Answered
Fitting Question
If you have the Curve Fitting TB use cftool to fit the data interactively. Otherwise an example: x = [0.0 0.5 1.0 2.0 5.0 8....

14 years ago | 1

Answered
Creating a Legend for a Boxplot with Two Colors
Use the option _labels_, dunno if it is a bug but legend doesn't seem to work.

14 years ago | 1

Answered
scatter3 in log-log-log
After calling scatter3 use this line of code: set(gca,'Xscale','log','Zscale','log','Yscale','log')

14 years ago | 2

| accepted

Answered
Find the function between variables
doc polyfit I addition to Walter's comments you may want to plot the data to see if the data follows some known relationship ...

14 years ago | 0

Answered
Math Question_ Combination
nchoosek(1:10,3)

14 years ago | 1

| accepted

Answered
standard deviation and mean
You can use <http://www.mathworks.com/help/techdoc/ref/errorbar.html errorbar>: % The data Y = [rand(12,1)*7 + 35; rand(12,1...

14 years ago | 0

| accepted

Answered
generating correlated series
If you have the stats TB then you just have to use <http://www.mathworks.com/help/toolbox/stats/mvnrnd.html mvnrand>, otherwise ...

14 years ago | 0

Load more