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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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);

etwa 11 Jahre vor | 0

Beantwortet
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)...

etwa 11 Jahre vor | 0

Beantwortet
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...

etwa 11 Jahre vor | 0

Beantwortet
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...

etwa 11 Jahre vor | 1

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 2

| akzeptiert

Beantwortet
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]...

etwa 11 Jahre vor | 1

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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

etwa 11 Jahre vor | 2

Beantwortet
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

etwa 11 Jahre vor | 0

Beantwortet
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)

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 1

| akzeptiert

Beantwortet
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>

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 1

| akzeptiert

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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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))

etwa 11 Jahre vor | 0

Beantwortet
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')...

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 1

| akzeptiert

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

etwa 11 Jahre vor | 0

Beantwortet
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(:))

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 1

| akzeptiert

Beantwortet
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...

etwa 11 Jahre vor | 0

| akzeptiert

Mehr laden