Answered
how can i make 10 arrays with random numbers?
General rule would be "don't do that!" Use a single array and refer to them by column index or if feel simply must use some nam...

11 years ago | 1

Answered
HOW CAN I PLOT MULTIPLE VERTICAL LINE ON THIS FIGURE
One of the more efficient ways to draw multiple lines is to build the x,y vectors separating the line end points with NaN. This...

11 years ago | 1

Answered
Add title to current axes
Just reread the question -- guess I didn't follow before. Yes, "TITLE" is included as an option under the "Insert" menu item on...

11 years ago | 0

Answered
Extract rows of a matrix containing the same value in the first column by a loop
*unique* is your friend... > [u,ia,ib]=unique(A(:,1)); >> for i=1:length(u) C(i)={A(ib==i,:)}; end >> C{:} ans ...

11 years ago | 1

| accepted

Answered
Time series, resample, axes, datetime
Use date numbers...example for an axes... >> dn=datenum(2000,1,1,0,0,[0:2:86400-1].'); % a day at 2-sec interval >> t=dn-...

11 years ago | 0

| accepted

Answered
How can i divide a (matrix) into two parts
Hard as James says to envision how you could do B and not be able to figure out C but C=A(241:end,:); Mayhaps it's *end*...

11 years ago | 0

Answered
How do I make multiple figures from one matrix of data in a loop?
You're looping over two indices for some reason and creating a figure every pass...to just do groups of columns nCols=3 %...

11 years ago | 0

Answered
how to calculate a serie of a function with two variables
xi=[list of four values]; eta=[list of four more presumably different values]; func=yourfunction(xi,eta); % compute the...

11 years ago | 2

Answered
Using fprintf with matrices with rational entries
Have to switch to string representation to do so or use the related *rat* function instead... [n d]=rat(x); for i=1:size...

11 years ago | 1

| accepted

Answered
How to speed up Bag of Visual Words Calculation ?
Looks like I glanced over the code too quickly and missed the key point, perhaps... for i=1:size(features,1) for j=1:s...

11 years ago | 0

| accepted

Answered
If only one positive elem per row (rest are 0), then fill both sides of positive element
Find the locations needing to be worked around. Pick one dimension first as you've done; I'll stick with the rows... >> ir...

11 years ago | 0

Answered
How do I eliminate index error in sum function.
clear i j nansum sum if for i = 1:48:length(dtkp) h2o_daily(j) = nansum(h2o_... You've cleared _j_ but reference it...

11 years ago | 0

| accepted

Answered
random function and its properties'?
So am I...the above doesn't work at least w/ R2012b... >> NUMMACHINES=200; SUPPX=[0,200]; DATADISTROX={'unif',SUPPX(1),SU...

11 years ago | 0

Answered
Indexing cannot yield multiple results
Clearly Main must be something other than a 3D array at this time or you've aliased *size* or somesuch. What does whos M...

11 years ago | 1

Answered
Data "hides" when using plotyy
OK, I redid your callback function as follows for the LH plot. It produces same result for multiple clicks now altho needs a re...

11 years ago | 0

| accepted

Answered
Repeat previous row if condition
I've no magic bullet but >> idx=find((diff([0; M(:,1)])>0 & diff([0; M(:,1)])~=10) | ... (diff([0; M(:,1)])<...

11 years ago | 0

Answered
Phase shift correction between 2 signals using cross-correlation
[c,lags]=xcorr(s1,s2); % compute cross correlation; keep lags vector [~,iLag]=max(c(find(lags==0):end)); % f...

11 years ago | 0

| accepted

Answered
How do I get the table to produce the results from vectors?
"Use the curlies, Luke..." :) You must dereference the cell arrays by the {} T = table(beta{:}, gamma{:}, Gv{:}) Not s...

11 years ago | 0

Answered
Importing csv file in matlab
Per the doc's >> help dlmread dlmread Read ASCII delimited file. ... RESULT = dlmread(FILENAME,DELIMITER) read...

11 years ago | 0

Answered
How can I use fprintf function to display an array sizes of mx n with headers both on columns and rows?
Simply incorporate another string field in the format string for the observation name (and remember to include the additional sp...

11 years ago | 0

| accepted

Answered
Optimizing code when using xlsread
You've got all the data in the first *xlsread*; use it directly... [mn,md,mi,mx,st]=grpstats(Data,[],{'mean','median','min'...

11 years ago | 0

Answered
cell array to vector using cell2mat
You answered the question in the title... >> c c = [1x4 double] [1x6 double] >> cell2mat(c) ans = 1 ...

11 years ago | 0

Answered
Neater way to use subplots?
See doc subplot % illustrates exactly that kind of thing... For your case, it's subplot(2,2,1); ... subplot(...

11 years ago | 0

Answered
fprintf function and how to use it.
Unfortunately, there is no format spec for "center in column", only left- and right-adjust. Thus, "yes, Virginia" you _do_ have...

11 years ago | 0

| accepted

Answered
What is the logic behind contradicting bins in the function histc?
It only "exists" when you inadvertently create a zero-width bin which is, imo, an input user error. The author(s) of *histc* ap...

11 years ago | 0

| accepted

Answered
saving matrices to text files
_"...if I want to save these variables to a text file, would it be something like this?"_ save ('variables.txt', x, y) N...

11 years ago | 0

Answered
Question about disp([]) and returning lines
*disp* is for when you don't really care about the formatting but just simpler output; it doesn't accept any formatting instruct...

11 years ago | 0

Answered
Linear Regression on log log plots
X=log10(x); Y=log10(y); % convert both variables to log's b=polyfit(X,Y,1); % estimate coefficients yhat=10.^[po...

12 years ago | 1

| accepted

Answered
Selecting specific columns to import from a CSV
fmt=[repmat('%*f',1,4) repmat('%f',1,2) '%*[^\n]']; fid=fopen('gps.csv'); data=cell2mat(textscan(fid,fmt,'collectoutput'...

12 years ago | 0

| accepted

Answered
Read numeric data with csvread
doc textscan % NB: optional 'commentstyle' parameter

12 years ago | 0

| accepted

Load more