Answered
2 Column Matrix to 1 column Matrix
a= [2 4 4 11 5 7 5 10 7 12 8 10 11 12 2 8];...

10 years ago | 0

| accepted

Answered
Import data from text sheet to a variable
fid = fopen('file.txt') data = textscan(fid, '%*s %*s %*s %*s %*s %f %*[^\n]','HeaderLines',1); fid = fclose(fid);

10 years ago | 0

Answered
How to keep track of last change in a variable inside the loop?
You can use a counter. Example for k=1:40 a=sin(k) if a>0.5 y=a ii=k end end disp(ii)...

10 years ago | 0

Answered
How do I input a variable that contains a previous variable?
Define nd as <http://www.mathworks.com/help/matlab/ref/persistent.html peristent> variable. Look at this example function y...

10 years ago | 0

Answered
separate empty cells (NaN) from others
If A is your cell array c12=A(:,12) id12=~cellfun(@isnan,c12) out=A(id12,:) If you want the part containing nan o...

10 years ago | 1

| accepted

Answered
Subscript indices must either be real positive integers or logicals
There is a problem with the lines of code containing: max(x) = Navios min(x) = Navios max and min are built-i...

10 years ago | 0

| accepted

Answered
Can this be accelerated?
<http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support/content//...

10 years ago | 0

| accepted

Answered
How to create a .mat file corresponding to a .txt file, as per user input?
xx=2; yy=14 filename=sprintf('Phase%dSubject%d.txt',xx,yy) data=dlmread(filename) save(filename,'data') % Save in a mat fi...

10 years ago | 0

| accepted

Answered
what does this format mean
[min_value,index] = min(X); % min-value is the min value and index is its index [~,best] = min(X); % gives only the ind...

10 years ago | 2

| accepted

Answered
How to format cells of a uitable?
data=rand(3,4); d=arrayfun(@(x) sprintf('%.2f\n',x),data,'un',0) h=uitable('Data',d,'Units','norm', 'Position',[0,.75,1,.25]...

10 years ago | 1

Answered
How to save corresponding elements in a matrix?
B=A(A(:,1)>3,:) If you want to save just the second column B=A(A(:,1)>3,2) You need to read some basics <http://www...

10 years ago | 0

| accepted

Answered
How to access a structure array using a loop?
s=genvarname(repmat({'p'},1,10),'p') for k=1:numel(s) out(k)=data.(s{k}) end

10 years ago | 2

Answered
matrix index (I tried to name a matrix to use in a loop like variables.)
You can use cell arrays A=cell(1,4) A{1}=[1 2;3 4] for k=2:numel(A) A{k}=A{k-1}*2 end

10 years ago | 0

Answered
Producing random numbers in Matlab?
Using rand n=4 m=6 a=[ones(1,n), zeros(1,m)] [~,idx]=sort(rand(1,m+n)) out=a(idx)

10 years ago | 0

Answered
Producing random numbers in Matlab?
n=4 a=randperm(2*n) out=a>n

10 years ago | 1

| accepted

Answered
red wire problem in npn, pnp and ground
<http://www.mathworks.com/help/physmod/sps/powersys/ug/building-and-simulating-a-simple-circuit.html#f10-23215>

10 years ago | 0

Answered
Unexpected MATLAB operator when using fully qualified path name
You have forgotten the quotes '/home/matlab/hw'

11 years ago | 1

| accepted

Answered
Automatically create matrix names
for i = 1:numel(a) out{k}=dlmread(fullfile(f,a{i}),'',4,1) end

11 years ago | 0

| accepted

Answered
Convert a cell to an array with a data type other than double
I guess your data looks like A={1 '2' 3;4 '5.55' 3.66;6 '14' 4.78} B=str2double(cellfun(@num2str,A,'un',0))

11 years ago | 0

Answered
Differentiating between a binary column and a decimal column from dlmread data.
If you use dlmread to read your text file, and your file looks like 1001 2 4 0101 3 5 0001 5 6 a=dlmread('file.txt')...

11 years ago | 0

Answered
How to create a cell array with natural numbers up to 1000?
num2cell(1:1000)

11 years ago | 1

| accepted

Answered
save the value in side the function file
k=0; a= 1; b=2; k=k+1 c{k}=bisect(@fun,a,b)

11 years ago | 0

Answered
save the value in side the function file
k=0; a= 1; b=2; k=k+1 c{k}=bisect(@fun,a,b)

11 years ago | 0

Answered
How to let y-axis ticks increase by 2?
Look at this t=0:0.001:10; y=12.5*sin(t) plot(t,y) yt=get(gca,'ylim') nyt=yt(1):2:yt(2) ytl=cellfun(@(x) sprintf('%.2f...

11 years ago | 0

| accepted

Answered
How to store a value in Simulink?
If you mean how to use the previous values, you can use <http://www.mathworks.com/help/simulink/slref/unitdelay.html unit delay ...

11 years ago | 0

Answered
Shuffling a vector for n times to generate a new vector
A = [3 5 1] n=10 a=perms(1:3)' m=size(a,1) k=randi(m,n,1) s=a(:,k) out=A(s(:))

11 years ago | 0

| accepted

Answered
Generating a long vector from two other vectors
a = [20 13 24 ]; b = [3 2 4 ]; out=cell2mat(arrayfun(@(x,y) repmat(x,1,y),a,b,'un',0)) or with a for loop a = [20 13...

11 years ago | 0

| accepted

Answered
GUI for reading multiple images into MATLAB
Use file=fullfile(PathName,FileNames{i}) image = imread(file);

11 years ago | 0

| accepted

Answered
How to call .m file?
just type the name of your script your_cript It's better to use functions <http://www.mathworks.com/help/matlab/ref/func...

11 years ago | 1

| accepted

Answered
Automate function and text reading tasks in MATLAB
<http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F> f='C:\Users\Documents\MATLAB' % The folder wh...

11 years ago | 0

| accepted

Load more