回答済み
How to select the row of an element in a vector and put it in the same row for a different matrix?
Well, much is undefined but the indexing is pretty simple... B(A==1,icol)=sum(A); Now, you'll have to iterate or otherwi...

10年以上 前 | 0

回答済み
repeating the same statement using loop
Refactor out the commonality into a subroutine where can use the same variable names without clashing with scope -- obj = 1...

10年以上 前 | 0

| 採用済み

回答済み
how to append data from mat file.?
I expect you'll just make your loading time worse but I'd use the *matfile* object to try this and see how it goes... Start b...

10年以上 前 | 0

回答済み
I need most efficient code for these commands
Well, as Walter says but replacing _"most"_ with _"more"_, with Matlab replacing all the exponentiations with their numeric equi...

10年以上 前 | 0

| 採用済み

回答済み
Referencing another row value if a number in the same row is false.
>> c={ 'Bob' 'Josh' , 0; 'John' 'Garrett', 1}; >> c(cellfun(@(x) x==0,c(:,3)),1:2) ans = 'Bo...

10年以上 前 | 0

回答済み
Moving window of 100 points with 20 points overlap.
Nfilt=20; b=ones(1,Nfilt)/Nfilt; % weights magFiltered=[nan filter(b,1,mag)]; % weight average (includes e...

10年以上 前 | 0

| 採用済み

回答済み
Count numbers for a specific string, in a cell with string names and numbers
If have the Stat Toolbox, use nominal variables and *grpstats* >> users=nominal(departusers(:,1)); % the department n...

10年以上 前 | 0

回答済み
Pass the content of a variable to a .bat file from matlab
Use *system* instead for command form to evaluate variables in building the command string. *!* ("Bang") interprets everything ...

10年以上 前 | 0

回答済み
legend for plotyy causes axes problem
There are multiple axes created by *plotyy* and *hold* operates on only one at a time (and, disappointingly, won't accept a vect...

10年以上 前 | 1

| 採用済み

回答済み
Why does 10^61 not equal 1e61 in MATLAB?
>> for i=3:40, if 10^i~=eval(['1E' num2str(i)]),disp(i),break,end,end 29 >> I may be wrong but I think most languag...

10年以上 前 | 0

回答済み
How to replace a number with 0 in an array
nCol=3; % say, for the particular column x(x(:,nCol)==0.5)=0; % turn to zero *NB:* While 0.5 is exac...

10年以上 前 | 2

| 採用済み

回答済み
Counting all the numbers above a certain threshold in a matrix, keeping each event seperate.
I'm not positive re: the comment about value being same for each column, either, but the given the prhasing I'm guessing it's re...

10年以上 前 | 0

| 採用済み

回答済み
Datetime with variable format
I'm frankly surprised the above doesn't give a syntax error on the duplicated named input, but guess it likely just takes the fi...

10年以上 前 | 1

回答済み
How to take seasonal average of monthly values?
Depends on storage order...if 10x12 (years x months), then Tseas=mean(reshape(T.',3,[])); If it's already in column order...

10年以上 前 | 0

| 採用済み

回答済み
How to write and save in an excel file?
I'd suggest a few changes-- XLfile = dir(); Why not use wildcard to only get .xls? files? Then can get rid of the other...

10年以上 前 | 0

回答済み
I am currently attempting to use the find function in Matlab and can not get it to work. Help?
You're testing only for the one case in which the score is precisely 0.5, for the *disp* statement _*not*_ that the score is a m...

10年以上 前 | 0

| 採用済み

回答済み
Matlab fractions into binary fractions help
>> i=[1 1 0 1]; f=[1 0 0 1 1 0]; >> sprintf([repmat('%d',1,length(i)) '.' repmat('%d',1,length(i))],i,f) ans = 1101.10011...

10年以上 前 | 0

回答済み
delete some columns in A and the same columns in another matrix C
>> idx=all(isnan(A(end-1:end,:))) idx = 1 1 0 0 >>

10年以上 前 | 0

回答済み
I'm calling a function which sets persistent variables. Is there anyway to access those persistent variables outside the function?
Newp, no can do. If you _could_ modify the function have it *assignin* the base workspace to a local variable but if you can't ...

10年以上 前 | 1

回答済み
Read and seperate CSV data
Your basic problem is the file was created as a text file of multiple strings which include the comma delimiters within them, no...

10年以上 前 | 0

回答済み
I am using textscan to extract data with an unknown number of columns.
Presuming the file is comma-delimited as shown in the example, it's pretty-much trivial--while it's been put into "redhaired-ste...

10年以上 前 | 0

回答済み
q(a,:)=0; means
See <http://www.mathworks.com/help/matlab/math/matrix-indexing.html matrix-indexing> Or, try x=rand(4); a=[1 3]; ...

10年以上 前 | 0

回答済み
Operations on consecutive elements of a vector
If'en I interprets your requirements correctly... d=[c(1) diff(c(1:end-1)) -c(end)]; Example: >> c=randi(10,1,5) c...

10年以上 前 | 0

| 採用済み

回答済み
How to create monthly average from daily data?
As noted in the comment, since the problem is insolvable without having the dates in some form, I'll just assume you can create ...

10年以上 前 | 0

回答済み
Ok I am just trying to display a matrix properly that has small numbers like 8.00e-5 but when i enter it in as a matrix i get .00001 instead of the correct number... any help?
>> format shorte >> x x = 8.0000e-05 8.0000e-04 2.0000e-03 3.5000e-03 4.0000e-03 4.7500e-03 >> doc form...

10年以上 前 | 0

| 採用済み

回答済み
What's wrong with tied ranks?
Answered in identical thread on newsgroup...short story is your two 0.6 values are similar-enough to print out the same to preci...

10年以上 前 | 0

回答済み
I want to plot the values of each month and the respective year in one line, so basically 34 lines in a plot to show how the values are changing for 34 years
_"...Uyear is a matrix with dimensions 34*12, how can i plot each row of that matrix as a line in a line plot"_ mo=[1:12]; ...

10年以上 前 | 0

回答済み
Fitting Polynomial Curve for 4,000 curves.
Same basic solution as Stephen's above excepting doing the conversion on the front end instead of the latter and having implicit...

10年以上 前 | 0

回答済み
how to extract this data?
As noted above, w/o a file to test, something like fid=fopen('yourfile'); % open file d=cell2mat(textscanf(fid,'','he...

10年以上 前 | 0

回答済み
Question about the legend command
Since it really isn't content of the x,y that you're interested in grouping on, create the grouping variable as (or similarly)--...

10年以上 前 | 0

さらに読み込む